signintech/gopdf

不支持书签的吗?

yiqiui opened this issue · 4 comments

yiqiui commented

Do you not support bookmarks? I hope to support this feature as soon as possible

yiqiui commented

Can you provide such a function to support bookmark functionality
pdf.Bookmark("Chapter 1", 0, 0)

Now we have only basic function like this.

package main

import (
	"log"

	"github.com/signintech/gopdf"
)

func main() {
	pdf := gopdf.GoPdf{}
	pdf.Start(gopdf.Config{Unit: gopdf.Unit_PT, PageSize: gopdf.Rect{W: 595.28, H: 841.89}}) //595.28, 841.89 = A4
	pdf.AddPage()
	err := pdf.AddTTFFont("FONTNAME", "fontfile.ttf")
	if err != nil {
		log.Print(err.Error())
		return
	}
	err = pdf.SetFont("FONTNAME", "", 14)
	if err != nil {
		log.Print(err.Error())
		return
	}

	pdf.Cell(nil, "A")
	pdf.Br(20)

	pdf.AddOutlineWithPosition("goto A")

	pdf.Cell(nil, "B")
	pdf.Br(20)

	pdf.AddOutlineWithPosition("goto B")

	pdf.AddPage()
	pdf.Cell(nil, "C")
	pdf.Br(20)

	pdf.AddOutlineWithPosition("goto C")

	pdf.WritePdf("outline.pdf")
}
Screenshot 2566-12-11 at 20 12 16

@yiqiui if this issue has been resolved, please close it.

@oneplus1000 can you close this issue if it has been resolved?