feat(转换能力): 增强PDF转换,优化大文档编辑,并支持直接保存OFD
build.yaml / build (push) Successful in 41s

This commit is contained in:
xiaoqidun committed 2026-09-24 20:34:43 +08:00
1 parent b30a44b7ce
commit 0bc3f69df0
9 files changed
+258 -32

No files matched your search

+10 -3
View File
@@ -15,21 +15,28 @@
package ofdgo
import (
"context"
"fmt"
"github.com/xiaoqidun/pdfgo"
)
// links 将无外观链接转换为OFD点击区域,其他注解或外观返回不支持错误
// 入参: page PDF页面
// annotations 将链接和签名外观按页面顺序转换为OFD对象
// 入参: ctx 取消上下文, page PDF页面
// 返回: error 错误信息
func (p *pdfImporter) links(page *pdfgo.Page) error {
func (p *pdfImporter) annotations(ctx context.Context, page *pdfgo.Page) error {
annotations, err := page.Annotations()
if err != nil {
return err
}
for _, annotation := range annotations {
dict := annotation.Dictionary
if annotation.Subtype == "Widget" {
if err := p.signatureWidget(ctx, page, annotation); err != nil {
return err
}
continue
}
if annotation.Subtype != "Link" {
return &pdfgo.UnsupportedError{Feature: "annotation " + string(annotation.Subtype)}
}