Aspose.HTML for Java – Parse, Convert, Process HTML Files

Aspose.HTML for Java logo

Aspose.HTML for Java is a Java API for creating, loading, editing, rendering, extracting data from, validating, and converting web documents. Use it when your Java application needs programmatic control over HTML documents, DOM nodes, CSS, resources, accessibility checks, or output formats such as PDF, XPS, DOCX, PNG, JPG, TIFF, BMP, and GIF.

Java HTML Development Topics

Convert HTML to PDF in Java

The following example uses HTMLDocument to load an HTML file, PdfSaveOptions to define PDF output, and Converter.convertHTML() to create document.pdf.

  1. Load document.html into an HTMLDocument.
  2. Create a PdfSaveOptions instance with default settings.
  3. Call Converter.convertHTML() with the document, options, and output path.
1import com.aspose.html.HTMLDocument;
2import com.aspose.html.converters.Converter;
3import com.aspose.html.saving.PdfSaveOptions;
4
5HTMLDocument document = new HTMLDocument("document.html");
6PdfSaveOptions options = new PdfSaveOptions();
7
8Converter.convertHTML(document, options, "document.pdf");

After the code runs, document.pdf contains the rendered content of document.html. For a detailed workflow and conversion settings, see Convert HTML to PDF in Java.

Aspose.HTML for Java Resources

Aspose.HTML also provides free online HTML applications for quick browser-based tasks. Use Aspose.HTML for Java when the workflow must be automated or integrated into a Java application.

Aspose.HTML free online applications