Convert html to other formats in Java

About HTML File Format

HTML (Hyper Text Markup Language) is the extension for web pages created for display in browsers. Known as language of the web, HTML has evolved with requirements of new information requirements to be displayed as part of web pages. The latest variant is known as HTML 5 that gives a lot of flexibility for working with the language. HTML pages are either received from server, where these are hosted, or can be loaded from local system as well.

Convert from HTML

With GroupDocs.Conversion you can easily convert your HTML document into another file format.
For example HTML to PDF conversion code snippet will look like this:

// Load the source HTML file
Converter converter = new Converter("sample.html");
// Set the convert options for PDF format
PdfConvertOptions options = new PdfConvertOptions();
// Convert to PDF format
converter.convert("converted.pdf", options);

Put it simply - you just load a HTML file into Converter, select desired output format and all the rest will be done by GroupDocs.Conversion.

Convert to HTML

On the other hand, converting your files to HTML format is also quite simple and natural. The following code sample demonstrates how to convert PDF document to HTML in Java using GroupDocs.Conversion.

// Load the source PDF file
Converter converter = new Converter("sample.pdf");
// Set the convert options for HTML format
MarkupConvertOptions options = new MarkupConvertOptions();
// Convert to HTML format
converter.convert("converted.html", options);