How to get pdf bookmarks in Prince pdf-WYSIWYG transformation?

Post here questions and problems related to editing and publishing DITA content.
berkeley
Posts: 8
Joined: Thu Sep 29, 2016 12:44 am

How to get pdf bookmarks in Prince pdf-WYSIWYG transformation?

Post by berkeley »

I'm using Oxygen XML Author 18.1 build 2016112217 and I'm trying to configure the WYSIWYG transformation so that the pdf generated with the Prince CSS processor has bookmarks.

I've tried adding:
*[class~='topic/topic'] { prince-bookmark-level: 1 }
*[class~='topic/topic'] > *[class~='topic/title'] { prince-bookmark-level: 2 }

or:
h1 { prince-bookmark-level: 1 }
h2 { prince-bookmark-level: 2 }

to p-styling.css based on https://www.princexml.com/doc/8.1/pdf-bookmarks/. I also tried setting p-styling.css in the args.css parameter in the scenario settings since CSS I had in p-styling.css didn't seem to be implemented automatically. But none of this has had an effect.

Thanks for your help,
Justine
Dan
Posts: 501
Joined: Mon Feb 03, 2003 10:56 am

Re: How to get pdf bookmarks in Prince pdf-WYSIWYG transformation?

Post by Dan »

Hello Justine,

You can use the following CSS snippet (it will be included in oXygen 19):

Code: Select all



@media print {

*[class~="topic/topic"] > *[class~="topic/title"] {
prince-bookmark-level: 1;
-ah-bookmark-level: 1;
}
*[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"] {
prince-bookmark-level: 2;
-ah-bookmark-level: 2;
}
*[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"] {
prince-bookmark-level: 3;
-ah-bookmark-level: 3;
}
*[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"] {
prince-bookmark-level: 4;
-ah-bookmark-level: 4;
}
*[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"] {
prince-bookmark-level: 5;
-ah-bookmark-level: 5;
}
*[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"] {
prince-bookmark-level: 6;
-ah-bookmark-level: 6;
}
*[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] *[class~="topic/topic"] > *[class~="topic/title"] {
prince-bookmark-level: 7;
-ah-bookmark-level: 7;
}

}

A good practice is to save this all the customization outside the oXygen installation directory (let say on the Desktop), then alter the transformation scenario "args.css" parameter to point to this additional CSS. In this way you will not loose the file when you upgrade to a new oXygen version.


Many regards,
Dan
berkeley
Posts: 8
Joined: Thu Sep 29, 2016 12:44 am

Re: How to get pdf bookmarks in Prince pdf-WYSIWYG transformation?

Post by berkeley »

Thanks, Dan. I hadn't put it in the @media {} container and that did the trick.
Post Reply