-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Desktop export PDF supports no pagination #16537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for non-paginated PDF export in the desktop application, allowing users to export documents as single continuous-page PDFs. The feature is controlled by a new "paged" checkbox in the PDF export dialog that defaults to enabled (maintaining current paginated behavior).
Key changes:
- Adds a "paged" toggle in the PDF export UI that controls whether the exported PDF uses standard pagination or continuous single-page layout
- Implements dynamic page size calculation for non-paginated exports by measuring content height and adjusting PDF dimensions accordingly
- Updates storage configuration to persist the user's pagination preference with backwards compatibility for legacy settings
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| app/src/protyle/export/index.ts | Adds pagination toggle UI control and implements dual-mode export logic with dynamic page sizing for continuous exports |
| app/src/boot/onGetConfig.ts | Updates PDF export handler to store pagination preference and conditionally render footer only for paginated exports |
| app/src/protyle/util/compatibility.ts | Adds default "paged: true" setting to local storage configuration for PDF exports |
| app/appearance/langs/*.json | Adds "paged" translation key across all 16 supported language files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
app/src/protyle/export/index.ts
Outdated
| const pageSizes = { | ||
| "A3": { width: 11.69, height: 16.54 }, | ||
| "A4": { width: 8.27, height: 11.69 }, | ||
| "A5": { width: 5.83, height: 8.27 }, | ||
| "Legal": { width: 8.5, height: 14 }, | ||
| "Letter": { width: 8.5, height: 11 }, | ||
| "Tabloid": { width: 11, height: 17 }, | ||
| }; |
Copilot
AI
Dec 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The page size dimensions are hardcoded as magic numbers without explanation. For example, A4 is defined as width: 8.27, height: 11.69, but it's unclear what units these represent (they appear to be inches).
Consider:
- Adding a comment explaining these are dimensions in inches
- Extracting these to a constant at the module level or importing from a shared configuration
- Using more descriptive variable names like 'widthInches' and 'heightInches' in the object definition
This would improve code clarity and make it easier to maintain if page sizes need to be updated or added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个和分页的大小看上去不太一样,这样是否导出就会导致 A4 的边距不一致?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
94d6f7c to
0379340
Compare
0379340 to
56ecf4e
Compare
# Conflicts: # app/appearance/langs/de_DE.json # app/appearance/langs/he_IL.json # app/appearance/langs/it_IT.json # app/appearance/langs/pl_PL.json # app/appearance/langs/pt_BR.json # app/appearance/langs/ru_RU.json
|
|
@Vanessa219 我觉得不分页的时候底下不需要显示页码 |
|
如果不显示的话,配置成其他页脚就无法显示了。 |
|
设置不分页,但是结果还是分页的,可能和引述块有关?测试过一个没有引述块的是正常不分页。两个有引述块的,哪怕长度不是很长也是两页。 |
|
好像和引述块没有关系,页面不够一页就会被分为很多小页面。 |


桌面端导出 PDF 支持不分页 https://ld246.com/article/1764933918963
导出的 PDF 是这样的效果: