mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 13:56:32 +08:00
1 parent
bbc8d59bdb
commit
725ea0eceb
3 files changed
+23
-5
No files matched your search
@@ -9,7 +9,7 @@ require (
|
||||
github.com/tdewolff/canvas v0.0.0-20260923214215-09804640d00c
|
||||
github.com/tdewolff/font v0.0.0-20260913163313-54f98bb59ee6
|
||||
github.com/xiaoqidun/jbig2 v1.1.1
|
||||
github.com/xiaoqidun/pdfgo v0.0.0-20260925061819-c89bfccf349d
|
||||
github.com/xiaoqidun/pdfgo v0.0.0-20260925101147-ee88b22d9f03
|
||||
golang.org/x/crypto v0.57.0
|
||||
golang.org/x/image v0.46.0
|
||||
golang.org/x/text v0.42.0
|
||||
|
||||
@@ -60,8 +60,8 @@ github.com/tdewolff/test v1.0.12 h1:7F21DqIajswxuche0geHdrUZRCWE4oko4b7bcmkkrxk=
|
||||
github.com/tdewolff/test v1.0.12/go.mod h1:XPuWBzvdUzhCuxWO1ojpXsyzsA5bFoS3tO/Q3kFuTG8=
|
||||
github.com/xiaoqidun/jbig2 v1.1.1 h1:SjliS9ZO0e9HX5oYUfBuXrfFsXhWricrSz+XY4zORDI=
|
||||
github.com/xiaoqidun/jbig2 v1.1.1/go.mod h1:8QonVWtENmh2kc6l+leqeGl7psb79DWlHDkCpdChjfQ=
|
||||
github.com/xiaoqidun/pdfgo v0.0.0-20260925061819-c89bfccf349d h1:hjdo01d4EsiNe9l0JNyc+Bqfrvdj9XGG786EYxAx3yw=
|
||||
github.com/xiaoqidun/pdfgo v0.0.0-20260925061819-c89bfccf349d/go.mod h1:/D0XHgfZ7xNhix95swpNaThpuqoJjVR5wIadogtR5pI=
|
||||
github.com/xiaoqidun/pdfgo v0.0.0-20260925101147-ee88b22d9f03 h1:aYnf/5Wz2sS68w+Tr7G/cfiw9p70RBE/dmgxwGbz21k=
|
||||
github.com/xiaoqidun/pdfgo v0.0.0-20260925101147-ee88b22d9f03/go.mod h1:/D0XHgfZ7xNhix95swpNaThpuqoJjVR5wIadogtR5pI=
|
||||
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
|
||||
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
|
||||
github.com/yuin/goldmark v1.8.5 h1:r6N5afV5qj/5S4UTch8agZHJ8UxNCMwX7WjkkJam2NA=
|
||||
|
||||
+20
-2
@@ -41,7 +41,7 @@ func (p *pdfImporter) annotations(ctx context.Context, page *pdfgo.Page, strict
|
||||
if annotation.Subtype != "Link" {
|
||||
return &pdfgo.UnsupportedError{Feature: "annotation " + string(annotation.Subtype)}
|
||||
}
|
||||
for _, key := range []pdfgo.Name{"AP", "AA", "BS", "OC"} {
|
||||
for _, key := range []pdfgo.Name{"AP", "AA", "OC"} {
|
||||
if dict[key] != nil {
|
||||
return &pdfgo.UnsupportedError{Feature: fmt.Sprintf("link annotation field %q", key)}
|
||||
}
|
||||
@@ -57,14 +57,32 @@ func (p *pdfImporter) annotations(ctx context.Context, page *pdfgo.Page, strict
|
||||
return &pdfgo.UnsupportedError{Feature: "link annotation flags"}
|
||||
}
|
||||
}
|
||||
borderStyle, err := p.reader.Resolve(dict["BS"])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if borderStyle != nil {
|
||||
style, ok := borderStyle.(pdfgo.Dictionary)
|
||||
if !ok {
|
||||
return fmt.Errorf("invalid PDF link border style")
|
||||
}
|
||||
width, err := p.reader.Resolve(style["W"])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if width != pdfgo.Integer(0) && width != pdfgo.Real(0) {
|
||||
return &pdfgo.UnsupportedError{Feature: "visible link border"}
|
||||
}
|
||||
} else {
|
||||
border, err := p.reader.Resolve(dict["Border"])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
array, ok := border.(pdfgo.Array)
|
||||
if !ok || len(array) != 3 || (array[2] != pdfgo.Integer(0) && array[2] != pdfgo.Real(0)) {
|
||||
if !ok || len(array) < 3 || (array[2] != pdfgo.Integer(0) && array[2] != pdfgo.Real(0)) {
|
||||
return &pdfgo.UnsupportedError{Feature: "visible link border"}
|
||||
}
|
||||
}
|
||||
action := Action{Event: "CLICK"}
|
||||
target := dict["Dest"]
|
||||
if dict["A"] != nil {
|
||||
|
||||
Reference in new issue
Block a user