Page 1 of 1

Adding page numbers to links in DITA PDFs generated with CSS?

Posted: Mon Oct 15, 2018 7:43 pm
by daudvyd
If I want to created a printed book from a large DITA map with many links, is there a way to automatically add a page number behind every link so that readers can still follow the links? For example, if the links happen to be capitalized, instead of "see LINK", I want the output to read "see LINK (p. 212)". Is there a best practice to accomplish this?

Re: Adding page numbers to links in DITA PDFs generated with CSS?

Posted: Tue Oct 16, 2018 10:39 am
by Dan
When applying the DITA Map to PDF (WYSIWIG or HTML5 based) transformation scenario, (having Chemistry as CSS processor ) you should automatically get links with a "(on page NN)" text following them.

Are the links working (i.e. are clickable and navigate correctly)?
What oXygen version are you using?

For your information, the builtin CSS rules are the following:

Code: Select all


*[class ~= "topic/xref"][href]:after,
*[class ~= "topic/link"][href]:after {
content: " (page " target-counter(attr(href), page) ")";
}
You can use them in the customization CSS.

Many regards,
Dan

Re: Adding page numbers to links in DITA PDFs generated with CSS?

Posted: Tue Oct 16, 2018 10:56 am
by daudvyd
Dan, thank you for the CSS code. That is very helpful to modify the results.