-
-
Notifications
You must be signed in to change notification settings - Fork 7
feat(PdfReader): add ShowPrint parameter #729
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
Changes from 5 commits
16fe32a
2fa21f7
ddef937
8471023
1322fff
af420db
ac27898
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -25,6 +25,12 @@ public partial class PdfReader | |||||
| [Parameter] | ||||||
| public bool ShowDownload { get; set; } = true; | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// 获得/设置 是否显示打印按钮 默认 true 显示 | ||||||
| /// </summary> | ||||||
| [Parameter] | ||||||
| public bool ShowPrint { get; set; } = true; | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// 获得/设置 是否显示缩略图 默认 true 显示 | ||||||
| /// </summary> | ||||||
|
|
@@ -59,13 +65,13 @@ public partial class PdfReader | |||||
| /// 获得/设置 是否适配当前页面宽度 默认 false | ||||||
|
||||||
| /// 获得/设置 是否适配当前页面宽度 默认 false | |
| /// 获得/设置 文档适配模式 默认 Auto |
Copilot
AI
Nov 27, 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 FitMode enum value is being passed directly to JavaScript, but it needs to be converted to its description string value (e.g., "page-width", "page-height"). It should be FitMode.ToDescriptionString() or a similar conversion, similar to what's done on line 232.
| FitMode, | |
| FitMode = FitMode.ToDescriptionString(), |
Copilot
AI
Nov 27, 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 documentation comment "适应页面宽度" (Fit to page width) is misleading. This method now sets any fit mode via parameter, not just page width. The comment should be updated to reflect the actual functionality, e.g., "设置文档适配模式" (Set document fit mode).
| /// 适应页面宽度 | |
| /// 设置文档适配模式 |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -51,17 +51,10 @@ export async function init(id, invoke, options) { | |||||
| Data.set(id, { el, pdfViewer }); | ||||||
| } | ||||||
|
|
||||||
| export function fitToWidth(id) { | ||||||
| export function setScaleValue(id, value) { | ||||||
| const { pdfViewer } = Data.get(id); | ||||||
| if (pdfViewer) { | ||||||
| pdfViewer.currentScaleValue = "page-height"; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| export function fitToPage(id) { | ||||||
| const { pdfViewer } = Data.get(id); | ||||||
| if (pdfViewer) { | ||||||
| pdfViewer.currentScaleValue = "page-width"; | ||||||
| pdfViewer.currentScaleValue = value; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -118,11 +111,8 @@ const resetTwoPagesOneView = (el, pdfViewer) => { | |||||
|
|
||||||
| const addEventListener = (el, pdfViewer, eventBus, invoke, options) => { | ||||||
| eventBus.on("pagesinit", async () => { | ||||||
| if (options.isFitToPage) { | ||||||
| pdfViewer.currentScaleValue = "page-width"; | ||||||
| } | ||||||
| else { | ||||||
| pdfViewer.currentScaleValue = "page-actual"; | ||||||
| if (options.fitMode) { | ||||||
| pdfViewer.currentScaleValue = fitMode; | ||||||
|
||||||
| pdfViewer.currentScaleValue = fitMode; | |
| pdfViewer.currentScaleValue = options.fitMode; |
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 dropdown items display raw technical values (e.g., "page-actual", "page-width") which are not user-friendly. Consider using localized or human-readable labels instead, similar to how the enum descriptions are used in Chinese comments (e.g., "实际大小" for PageActual, "页面宽度" for PageWidth).