♻️ Upgrade pdfcpu to v0.9.1 https://github.com/siyuan-note/siyuan/issues/13305
This commit is contained in:
parent
384bec36a3
commit
4feaa2aa5f
4 changed files with 12 additions and 6 deletions
|
@ -177,14 +177,14 @@ require (
|
|||
|
||||
replace github.com/mattn/go-sqlite3 => github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950
|
||||
|
||||
replace github.com/pdfcpu/pdfcpu => github.com/88250/pdfcpu v0.3.14-0.20241128120530-05a73e90be3e
|
||||
replace github.com/pdfcpu/pdfcpu => github.com/88250/pdfcpu v0.3.14-0.20241128123312-a688ff960d4f
|
||||
|
||||
//replace github.com/88250/lute => F:\golang\gopath\src\github.com\88250\lute
|
||||
//replace github.com/siyuan-note/dejavu => D:\88250\dejavu
|
||||
//replace github.com/siyuan-note/riff => D:\88250\riff
|
||||
//replace github.com/siyuan-note/httpclient => D:\88250\httpclient
|
||||
//replace github.com/siyuan-note/filelock => D:\88250\filelock
|
||||
//replace github.com/pdfcpu/pdfcpu => D:\pdfcpu
|
||||
//replace github.com/pdfcpu/pdfcpu => D:\88250\pdfcpu
|
||||
//replace github.com/88250/gulu => D:\88250\gulu
|
||||
//replace github.com/mattn/go-sqlite3 => D:\88250\go-sqlite3
|
||||
//replace github.com/88250/epub => D:\88250\epub
|
||||
|
|
|
@ -16,8 +16,8 @@ github.com/88250/gulu v1.2.3-0.20241127120230-1ae6a9868a2d h1:dexFyk3UkR4c2xpyrC
|
|||
github.com/88250/gulu v1.2.3-0.20241127120230-1ae6a9868a2d/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8=
|
||||
github.com/88250/lute v1.7.7-0.20241127031345-f772b0ee2be8 h1:1gWOQT9m2o3E6X//wvI+bexbXgdHheN6YUZcABHMm4k=
|
||||
github.com/88250/lute v1.7.7-0.20241127031345-f772b0ee2be8/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20241128120530-05a73e90be3e h1:juhQRP4rYNB1mVySivwuUaa1sIF10LQkbOmNPnCNjwA=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20241128120530-05a73e90be3e/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20241128123312-a688ff960d4f h1:oUW8FPgQ/RQzDG3nll1Qe3FfmBvelxjDkNNipF1ntck=
|
||||
github.com/88250/pdfcpu v0.3.14-0.20241128123312-a688ff960d4f/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
|
||||
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1/go.mod h1:U3pckKQIgxxkmZjV5yXQjHdGxQK0o/vEZeZ6cQsxfHw=
|
||||
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4 h1:r10k4+Lu1mDpiCKa1liAdGJUhB4BJHHJnMvtoli6Hts=
|
||||
|
|
|
@ -812,7 +812,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do
|
|||
link.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(" ")})
|
||||
link.AppendChild(&ast.Node{Type: ast.NodeCloseBracket})
|
||||
link.AppendChild(&ast.Node{Type: ast.NodeOpenParen})
|
||||
link.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: []byte("pdf-outline://" + h.ID)})
|
||||
link.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: []byte(PdfOutlineScheme + "://" + h.ID)})
|
||||
link.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
|
||||
h.PrependChild(link)
|
||||
}
|
||||
|
@ -1201,6 +1201,10 @@ func processPDFLinkEmbedAssets(pdfCtx *model.Context, assetDests []string, remov
|
|||
return
|
||||
}
|
||||
|
||||
if 1 > len(assetLinks) {
|
||||
return
|
||||
}
|
||||
|
||||
if _, removeErr := pdfcpu.RemoveAnnotations(pdfCtx, nil, nil, nil, false); nil != removeErr {
|
||||
logging.LogWarnf("remove annotations failed: %s", removeErr)
|
||||
}
|
||||
|
|
|
@ -42,13 +42,15 @@ func PdfListLinks(ctx *model.Context) (assets, others []model.LinkAnnotation, er
|
|||
return
|
||||
}
|
||||
|
||||
const PdfOutlineScheme = "pdf-outline"
|
||||
|
||||
func PdfListToCLinks(ctx *model.Context) (ret []model.LinkAnnotation, err error) {
|
||||
for pg, annos := range ctx.PageAnnots {
|
||||
for k, v := range annos {
|
||||
if model.AnnLink == k {
|
||||
for _, va := range v.Map {
|
||||
link := va.ContentString()
|
||||
if strings.HasPrefix(link, "pdf-outline://") {
|
||||
if strings.HasPrefix(link, PdfOutlineScheme+"://") {
|
||||
l := va.(model.LinkAnnotation)
|
||||
l.Page = pg
|
||||
ret = append(ret, l)
|
||||
|
|
Loading…
Add table
Reference in a new issue