HTML to PDF
PdfDocument class provides several static methods that allow Java developers to render HTML content from several different sources.
PdfDocument.renderHtmlAsPdf, as shown in the example above, transforms a string containing HTML markup into its PDF form. To convert web content located on a local network or across the Internet, call the
PdfDocument.renderUrlAsPdf, which accepts a string containing the URL of the web page to be rendered. For HTML files saved to a local filesystem directory, specify their paths in calls to the
Developers can customize the appearance of the PDF documents returned from the three previous methods using the
ChromePdfRenderOptions class. Refer to the API specification for the
ChromePdfRenderOptions for more information.