HTML to TIFF Conversion with the Java API

Aspose.HTML for Java renders HTML as TIFF with Converter.convertHTML() . Load the source into HTMLDocument, select ImageFormat.Tiff in ImageSaveOptions, and specify the output path. The conversion processes page layout, CSS, fonts, and linked image resources.


Generate TIFF Output from HTML

The example loads document.html, selects TIFF output, and writes the rendered result to output.tiff.

Convert HTML to TIFF in Java

import com.aspose.html.HTMLDocument;
import com.aspose.html.converters.Converter;
import com.aspose.html.rendering.image.ImageFormat;
import com.aspose.html.saving.ImageSaveOptions;

// Load the HTML document
try (HTMLDocument document = new HTMLDocument("document.html")) {
    // Select TIFF output
    ImageSaveOptions options = new ImageSaveOptions(ImageFormat.Tiff);

    // Convert HTML to TIFF
    Converter.convertHTML(document, options, "output.tiff");
}

Check HTML to TIFF Conversion Online

Upload an HTML file or provide a webpage URL to inspect the TIFF output before implementing the conversion in Java.

HTML to TIFF API Workflow

  1. Add Aspose.HTML for Java to the project.
  2. Load the source with HTMLDocument .
  3. Create ImageSaveOptions with ImageFormat.Tiff.
  4. Call Converter.convertHTML() with the source, options, and output path.

Choose TIFF Compression and Resolution

In addition to page size, margins, background, resolution, and rendering quality, ImageSaveOptions lets you select TIFF compression. The default TIFF compression is LZW. Select settings according to the required file size, image fidelity, and compatibility with the target TIFF reader.

See Convert HTML to Image in Java and the ImageSaveOptions API Reference .


Install Aspose.HTML for Java

Add Aspose.HTML for Java from the official Aspose repository. Replace ASPOSE_HTML_VERSION with an exact version from the Aspose.HTML for Java releases page, then reload or rebuild the project so the dependency is resolved.

Add the repository and dependency to the Maven project:

Maven – pom.xml

<repositories>
    <repository>
        <id>AsposeJavaAPI</id>
        <url>https://releases.aspose.com/java/repo/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-html</artifactId>
        <version>ASPOSE_HTML_VERSION</version>
    </dependency>
</dependencies>

Add the repository and dependency to the Gradle project:

Gradle – build.gradle

repositories {
    maven {
        url = uri('https://releases.aspose.com/java/repo/')
    }
}
dependencies {
    implementation 'com.aspose:aspose-html:ASPOSE_HTML_VERSION'
}

Use a JDK compatible with the selected release. For manual JAR installation, Kotlin DSL, updates, and dependency troubleshooting, see Install Aspose.HTML for Java .


HTML to TIFF Conversion FAQ

1. Can I choose TIFF compression during HTML conversion?

Yes. Configure the TIFF compression value in ImageSaveOptions before conversion. LZW is the default TIFF compression used by the save options.

2. When is TIFF preferable to PNG or JPG for HTML output?

TIFF is commonly used in document imaging, scanning, publishing, and archival workflows that require TIFF-compatible processing. PNG is often simpler for web images, while JPG is smaller for photographs.

3. Can I change the TIFF resolution produced from HTML?

Yes. Set horizontal and vertical resolution in ImageSaveOptions. You can also configure page size, margins, background color, and rendering quality.

4. Can I convert HTML to TIFF online for free?

Yes. Use the free online HTML to TIFF converter for a manual conversion. Use Aspose.HTML for Java for batch or server-side processing.

Related Java Conversions

Choose another output format for the same HTML source.