2

My client has some web pages that have A tag links with onmousedown events on them. My tools are PHP, Linux, and the tools for PDF generation there like DomPDF and PHP PDF. Is there a way to put the links into a PDF with the onmousedown Javascript code still working? The onmousedown events change the href.

I mean, I hear that PDF files can have Javascript in them, but I don't know if that also means the onmousedown event can be included as well and still operate.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Volomike
  • 23,743
  • 21
  • 113
  • 209
  • 1
    Why not just link to the intended target? Is the URL being intentionally obfuscated? Or are you attempting to send the user to a different location on each click? – BrianS Jan 21 '11 at 20:31

1 Answers1

0

Current stable releases of dompdf ignore JavaScript when rendering a document. The next release (0.6.0) will include the capability of including JavaScript in the rendered document, but the JavaScript has to be contained inside a script element that is in the body of the document. Because of this requirement you would have to write a function that locates your link and appends onmousedown events.

I don't know enough about using JavaScript in PDF document to say how easy it would be to write a script to do what you want.

BrianS
  • 13,284
  • 15
  • 62
  • 125