pdftk can't retrieve bookmarks page number #101

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

Comments

Projects
None yet
2 participants
@jamma313
Contributor

jamma313 commented Jun 27, 2013

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

This comment has been minimized.

Show comment
Hide comment
@SimonSapin

SimonSapin Jun 28, 2013

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.

Member

SimonSapin commented Jun 28, 2013

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

This comment has been minimized.

Show comment
Hide comment
@jamma313

jamma313 Jun 28, 2013

Contributor

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']))
Contributor

jamma313 commented Jun 28, 2013

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