feat(打印能力): 新增打印并优化界面布局
build.yaml / build (push) Successful in 46s

This commit is contained in:
xiaoqidun committed 2026-10-24 20:53:46 +08:00
1 parent 799041171b
commit 0ae9ad6562
22 files changed
+2220 -21

No files matched your search

+18
View File
@@ -77,6 +77,9 @@ func (r *Renderer) WalkPage(page *PageContent, visitor PageVisitor) error {
}
}
for order := range 3 {
if r.printing && (r.printContents == "annotations" || r.printContents == "forms") {
break
}
if r.Reader.doc != nil {
for _, ref := range page.Template {
kind := ref.ZOrder
@@ -103,6 +106,18 @@ func (r *Renderer) WalkPage(page *PageContent, visitor PageVisitor) error {
}
if r.RenderAnnotations {
for _, annotation := range r.Reader.Annots[page.ID] {
if r.printing && (r.printContents == "document" && annotation.Subtype != "Widget" || r.printContents == "forms" && annotation.Subtype != "Widget" || r.printContents == "annotations" && annotation.Subtype == "Widget") {
continue
}
if r.printing && annotation.Parameters != nil {
for _, parameter := range annotation.Parameters.Parameter {
if parameter.Name == "PDF.Printable" && (parameter.Value == "true" || parameter.Value == "false") {
visible := parameter.Value == "true"
annotation.Visible = &visible
break
}
}
}
if annotation.Visible != nil && !*annotation.Visible && !pageIncludesHidden(visitor) {
continue
}
@@ -111,6 +126,9 @@ func (r *Renderer) WalkPage(page *PageContent, visitor PageVisitor) error {
}
}
}
if r.printing && (r.printContents == "annotations" || r.printContents == "forms") {
return nil
}
for _, stamp := range r.Reader.Stamps[page.ID] {
if r.pageContext != nil {
if err := r.pageContext.Err(); err != nil {