Forum How do I...?

How do I correctly set PDF bookmarks?

0xhc
Hey there,

My team is building a software that makes use of Prince to generate rich PDF outputs, and we're currently facing a weird issue.

First of all, we use XHTML. We also generate different CSS blocks to set the Prince tags for bookmarks, see this example:

*[ns|style-id='style-1'] {
	-prince-bookmark-level: 1;
        -prince-bookmark-label: "Some value"
}
*[ns|style-id='style-2'] {
	-prince-bookmark-level: 2;
        -prince-bookmark-label: "Some value 2"
}


Then, those classes are applied to the following elements:

<topic ns:style-id="style-1">
    ...some nodes here...
    <topic ns:style-id="style-2">
        ...some nodes here...
    </topic>
</topic>


The issue we're having is that the PDF bookmarks are duplicated. We can only see this when "PDF bookmark tags" are set in nodes whose name is the same and are nested. The PDF outline would look like:

  • Some value
    • Some value 2
  • Some value
    • Some value 2

Are we missing something? Thanks in advance!
mikeday
Any chance there are block elements inside inline elements? This will result in the inline elements being split and duplicated.
0xhc
Apologies, the final example of the result that Prince generates is not correct. What we are actually getting is the following:
  • Some value
  • Some value
    • Some value 2

    So, it is not a problem of having block content inside inline. The problem is the duplicate content of the nested <topic>s.
mikeday
Would you be able to attach or email me (mikeday@yeslogic.com) a simple example document and CSS that demonstrates the problem?
0xhc
I just sent you an email, thanks Mike!