Producing a pdf with internal anchor links using dompdf

Viewed 3900

I am using dompdf to collate a load of existing HTML pages. A lot of these pages have anchor links in them that I would like to preserve. When I collate these articles the pdf collates very nicely but the anchors links don't work. The text is underlined like a link but on clicking it you don't go anywhere.

I have some test HTML that I am using to try out anchor links. Such as:

$content .= '<div style="page-break-after: always;"><a href="#link">blah</a></div> 
             <div><a id="blah">link location</a></div>';

and also I have tried using name instead of id, based on this forum post - http://www.dashinteractive.net/dompdf/index.php?v=1530231. Such as:

$content .= '<div style="page-break-after: always;"><a href="#link">blah</a></div> 
             <div><a name="blah">link location</a></div>';

Of course neither of these are working as I would expect.

I can't find much on the internet about how dompdf handles internal links. Apart from this page http://webresourcesdepot.com/html-to-pdf-rendering-engine-dompdf/ that says it can handle links and anchors. Not sure how reliable it is...

How do you put internal anchor links in pdfs using dompdf please? Can it do it?

1 Answers
Related