Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不支持书签的吗? #276

Open
yiqiui opened this issue Dec 11, 2023 · 2 comments
Open

不支持书签的吗? #276

yiqiui opened this issue Dec 11, 2023 · 2 comments

Comments

@yiqiui
Copy link

yiqiui commented Dec 11, 2023

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

@yiqiui
Copy link
Author

yiqiui commented Dec 11, 2023

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

@oneplus1000
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants