Forum How do I...?

Convert dynamically generated HTML (with PHP extension) to a PDF

alynch
Hi there

I am trying to convert a HTML document to a PDF. The resulting HTML is printed by the server using PHP to insert some values into the document.

Prince will not convert my .php file to a .pdf file. However, when I remove the .php extension and replace it with .html, a PDF is produced just fine.

How can I convert a PHP file to a PDF file using Prince? Can it be done?

Thanks in advance.
mikeday
Yes, specify "-i html" on the command-line so that Prince parses the file as HTML and not XML.
alynch
Hi Mike

Thanks for your reply. That works like a treat.

Can this be done through the PHP wrapper as well?

Thanks in advance.
mikeday
Yes, with prince->setInputType("html").