Free Support Forum -

HTML to PDF Conversion in Java


I’m evaluating the GroupDocs.Conversion for Java Library. So far our tests have been successful.

According to the features of the library, conversion from HTML to PDF is supported.

I can not find in the documentation how to run this conversion. Could you share with me some sample code for this kind of conversion.




Below is the code to convert a HTML file to PDF using GroupDocs.Conversion for Java 20.2.1.

Converter converter = new Converter("sample.html");
PdfConvertOptions options = new PdfConvertOptions();
converter.convert("converted.pdf", options);

API provides a lot of conversion options such as:

  • Set height
  • Set width
  • DPI

Have a look at this documentation article.