How to make pdf bookmark with renderx(XSL)

391 Views Asked by At

I have to modify the xsl of a file to make a pdf. We used to use AntennaHouse, but someone decided that we should now use RenderX. So I need to find an equivalent to

<fo:block axf:outline-level="{$bookmark-level}" axf:outline-expand="false" axf:outline-title="{$bookmark-title}">
</fo:block>

I've tried by changing axf to rx, it compiles but no bookmark are displayed on the pdf.

I've also tried using

<rx:outline>
    <rx:bookmark internal-destination="">
        <rx:bookmark-label>
            section
        </rx:bookmark-label>
    </rx:bookmark>
</rx:outline>

But this solution does not work either.

Ideally I would like to make bookmark sporadically in the xsl (Since it is how it is currently made in the xsl file). In other words I don't want to do it all at the start of the xsl file.

Anyone has a soultion?

EDIT:

I slightly changed my code to

<fo:block id="section1">Section 1</fo:block>
    <rx:outline>
        <rx:bookmark internal-destination="section1">
            <rx:bookmark-label>
                section
            </rx:bookmark-label>
       </rx:bookmark>
   </rx:outline>
1

There are 1 best solutions below

4
On BEST ANSWER

First, your XSL or FO must include the rx: namespace as:

 xmlns:rx="http://www.renderx.com/XSL/Extensions"

Your not pointing the bookmark to anything. You have no internal destination. If you had:

<rx:outline>
<rx:bookmark internal-destination="section1">
    <rx:bookmark-label>
        section
    </rx:bookmark-label>
</rx:bookmark>
</rx:outline>

And later in the document, something like:

<fo:block id="section1">Section 1</fo:block>

Then it should work. Normally those id's are generated with some function like generate-id().

see http://www.renderx.com/tutorial.html#PDF_Bookmarks

Note, you can also avoid the namespace and use XSL 1.1 outline structures.

<fo:bookmark-tree> = <rx:outline>
<fo:bookmark> = <rx:bookmark>
<fo:bookmark-title> = <rx:bookmark-label>