Forum How do I...?

Links to Sections in External PDFs?

ikaruga
I'm creating two PDFs using HTML. Is there a way to link to a specific section in the other?

Ex:

File1
<div id="sec1">Hello world</div>
<div id="sec2">Another page</div>


File2
<a href=File1.pdf#sec1">Link to sec1 in file 1</a>


As per the Adobe specs, the link is supposed to work. And sure enough if I do a reference to a page (ex: <a href=File1.pdf#page=2>) that works.... However, linking to internal sections of external PDFs doesn't seem to work.
mikeday
At the moment Prince does not create any named destinations in generated PDF files, so only page number links will work.

Update: Actually, I completely forgot about that prince-pdf-destination property that we added support for last year. :D

You can try something like this:
div { prince-pdf-destination: attr(id) }

You may need to use #nameddest=NAME to make the link work.
ikaruga
Yes! Thanks very much for the tip.

Note that, for reference, the links work only in Adobe Acrobat Reader. Named destination links don't work in evince and mupdf (two alternative PDF viewers).