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

pdftk can't retrieve bookmarks page number #101

Closed
jamma313 opened this issue Jun 27, 2013 · 2 comments
Closed

pdftk can't retrieve bookmarks page number #101

jamma313 opened this issue Jun 27, 2013 · 2 comments

Comments

@jamma313
Copy link
Contributor

It seems that pdftk can not retrieves page number bookmarks.

From http://weasyprint.org/samples/CSS21-intro.pdf :

$ pdftk CSS21-intro.pdf dump_data
InfoKey: Producer
InfoValue: WeasyPrint 0.17 (http://weasyprint.org/)
NumberOfPages: 9
BookmarkTitle: 2.1 A brief CSS 2.1 tutorial for HTML
BookmarkLevel: 1
BookmarkPageNumber: 0
BookmarkTitle: 2.2 A brief CSS 2.1 tutorial for XML
BookmarkLevel: 1
BookmarkPageNumber: 0
BookmarkTitle: 2.3 The CSS 2.1 processing model
BookmarkLevel: 1
BookmarkPageNumber: 0
BookmarkTitle: 2.3.1 The canvas
BookmarkLevel: 2
BookmarkPageNumber: 0
BookmarkTitle: 2.3.2 CSS 2.1 addressing model
BookmarkLevel: 2
BookmarkPageNumber: 0
BookmarkTitle: 2.4 CSS design principles
BookmarkLevel: 1
BookmarkPageNumber: 0

Same problem with a PDF generated with Weasyprint 0.19.2.

@SimonSapin
Copy link
Member

I could reproduce this, but I have no idea what’s wrong. The bookmarks lead to the right pages in evince and other PDF viewers.

@jamma313
Copy link
Contributor Author

It seems that if you use page object id instead of page number it works.

Here is a diff for a patch :

$ diff pdf.py.new pdf.py
389,392c389,390
<                 '/D [{0} 0 R /XYZ {1:f} {2:f} 0] >>\n',
<                 pdf.pages[bookmark['target'][0]].object_number,
<                 bookmark['target'][1],
<                 bookmark['target'][2]))
---
>                 '/D [{0} /XYZ {1:f} {2:f} 0] >>\n',
>                 *bookmark['target']))

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