feat(转换能力): 完善表单外观转换
build.yaml / build (push) Successful in 44s

This commit is contained in:
xiaoqidun committed 2026-09-28 18:40:04 +08:00
1 parent 056d7c3979
commit 035bbfb079
3 files changed
+19 -4

No files matched your search

+16 -1
View File
@@ -69,6 +69,21 @@ func (p *pdfImporter) appearanceAnnotation(ctx context.Context, page *pdfgo.Page
stamp.clipTexts = make(map[*pdfgo.TextClip]TextObject)
stamp.pageWidth, stamp.pageHeight = box.W, box.H
nodes, err := p.collectCompositeNodes(func(visitor pdfgo.Visitor) error {
if annotation.Subtype == "Widget" {
visitor.MarkedContent = func(mark pdfgo.MarkedContentMark) error {
if mark.Tag == "Tx" && len(mark.Properties) == 0 {
return nil
}
if mark.Operator == "EMC" {
return nil
}
if p.warning == nil {
return &pdfgo.UnsupportedError{Feature: "widget marked content " + string(mark.Tag)}
}
p.warning(pdfgo.Diagnostic{Message: "PDF widget marked content " + string(mark.Tag) + " not preserved"})
return nil
}
}
return p.reader.WalkAnnotationAppearance(ctx, page, annotation, visitor)
})
if err != nil {
@@ -238,7 +253,7 @@ func (p *pdfImporter) formWidget(ctx context.Context, page *pdfgo.Page, annotati
p.report.Warnings = append(p.report.Warnings, pdfgo.Diagnostic{Page: p.page + 1, Message: "hidden PDF form field not transferred"})
return nil
}
if flags&(8|16) != 0 || annotation.Dictionary["OC"] != nil {
if annotation.Dictionary["OC"] != nil {
return &pdfgo.UnsupportedError{Feature: "widget viewing behavior"}
}
if err := p.appearanceAnnotation(ctx, page, annotation); err != nil {