mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
♻️ 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
|
|
@ -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
Add a link
Reference in a new issue