Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Use the HTML Converter guides when the source is an HTML file, HTML string, stream, or URL. Aspose.HTML for Java converts HTML to PDF, XPS, DOCX, JPG, PNG, BMP, TIFF, GIF, MHTML, and Markdown.
Most HTML conversion workflows use an
HTMLDocument, save options for the target format, and the
convertHTML() methods of the Converter class. Ideal for generating printable documents, thumbnails, or web‑friendly files directly from Java applications.
HTMLDocument, or pass supported source content directly to a convertHTML() overload.PdfSaveOptions, ImageSaveOptions, DocSaveOptions, XpsSaveOptions, MHTMLSaveOptions, or MarkdownSaveOptions.Converter.convertHTML() with the source, save options, and output path.The following Java example loads nature.html, selects PNG with ImageSaveOptions, and converts the document to nature-output.png.
1// Convert HTML to PNG in Java
2
3// Initialize an HTML document from a file
4HTMLDocument document = new HTMLDocument("nature.html");
5
6// Initialize ImageSaveOptions
7ImageSaveOptions options = new ImageSaveOptions(ImageFormat.Png);
8
9// Convert HTML to PNG
10Converter.convertHTML(document, options, "nature-output.png");HTML to fixed-layout documents
PdfSaveOptions.XpsSaveOptions.HTML to editable documents and web formats
DocSaveOptions.MarkdownSaveOptions.HTML to image formats
ImageSaveOptions.Use the free online HTML Converter for quick manual conversions without writing code. Use Aspose.HTML for Java when HTML conversion must run programmatically in a Java application or document-processing workflow.
Download complete Java examples and data files from GitHub.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.