tags:

views:

55

answers:

0

Hey StackOverflow, I'm a new member but still hoping someone might be able to help if they can!

I'm using dompdf to generate PDFs in PHP. All is well when it parses a standard <a href="...">[Link]</a> style link: the generated PDF contains clickable hyperlinks.

However, my source text (i.e. the content of the PDF) contains anchor tags which have other tags inside them, for example an <em> tag:

<a href="..."><em>Italics link!</em></a>

Dompdf interprets this as a link (i.e. it is styled blue and underlined in the resultant PDF), but doesn't make it clickable.

This is reproducible this on the sandbox they have, if you try each of the following:

  1. <a href="http://google.com"&gt;Here is a link to Google</a>
  2. <a href="http://google.com"&gt;Here is a link to <em>Google</em></a>
  3. <a href="http://google.com"&gt;&lt;em&gt;Here is a link to Google</em></a>

Each successive snippet becomes less 'clickable', with 3 being simply blue and underlined.

I've tried using Tidy to 'repair' the source text, but doesn't seem to be invalid, so it isn't repaired.

Could anyone advise how to either:

  1. Use regex or something similar to find any <*> and replace with to repair the source text, or
  2. Configure dompdf to accept the given markup
  3. ... any other ideas? :)

Thanks in advance!