feat(注解转换): 完善注解合成并优化转换
build.yaml / build (push) Successful in 41s

This commit is contained in:
xiaoqidun committed 2026-09-28 16:16:05 +08:00
1 parent ee6c9f6a16
commit 1d365d29db
9 files changed
+132 -271

No files matched your search

+20 -1
View File
@@ -176,6 +176,25 @@ func (p *pdfImporter) annotations(ctx context.Context, page *pdfgo.Page, strict
switch a["S"] {
case pdfgo.Name("GoTo"):
target = a["D"]
case pdfgo.Name("Named"):
value, err := p.reader.Resolve(a["N"])
if err != nil {
return err
}
index := p.page
switch value {
case pdfgo.Name("FirstPage"):
index = 0
case pdfgo.Name("LastPage"):
index = len(p.editor.pages) - 1
case pdfgo.Name("NextPage"):
index = min(index+1, len(p.editor.pages)-1)
case pdfgo.Name("PrevPage"):
index = max(index-1, 0)
default:
return &pdfgo.UnsupportedError{Feature: "named link action"}
}
action.Goto = &Goto{Dest: &Dest{Type: "XYZ", PageID: p.editor.pages[index].ID, OmitLeft: true, OmitTop: true, OmitZoom: true}}
case pdfgo.Name("URI"):
value, err := p.reader.Resolve(a["URI"])
if err != nil {
@@ -204,7 +223,7 @@ func (p *pdfImporter) annotations(ctx context.Context, page *pdfgo.Page, strict
return &pdfgo.UnsupportedError{Feature: "link action"}
}
}
if action.URI == nil {
if action.URI == nil && action.Goto == nil {
destination, err := p.reader.ReadDestination(target)
if err != nil {
if !strict && errors.Is(err, pdfgo.ErrDestinationNotFound) {