Forum How do I...?

Convert HTML to PDF via the Java api?

haprogrammer
From the documentation it appears that I can only convert XML to pdf, is his correct or can I overload the same method just pass in the HTML instead of XML?

5) public boolean convert(String xmlPath, String pdfPath) throws IOException

xmlPath -- the full path of the xml file.
pdfPath -- the full path of the output pdf file.

This method converts the xml file to pdf file. The output pdf file will be placed in the
directory specified by pdfPath. It returns TRUE if the conversion is successful, FALSE if the
conversion fails.
mikeday
Yes, HTML files will also be accepted with this method.
htl
check for another example/api on
dancrintea.ro/html-to-pdf/
middle of the page.