<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-html-cloud</artifactId>
<version>22.12.1</version>
</dependency>
copied!  
compile(group: 'com.aspose', name: 'aspose-html-cloud', version: '22.12.1')
copied!  
<dependency org="com.aspose" name="aspose-html-cloud" rev="22.12.1">
 <artifact name="aspose-html-cloud" ext="jar"/>
</dependency>
copied!  
libraryDependencies += "com.aspose" % "aspose-html-cloud" % "22.12.1"
copied!  

HTML Rendering & Conversion Java Cloud REST API

main-banner

Product Page | Documentation | Live Demo | Swagger UI | Code Samples | Blog | Free Support | Free Trial

Aspose.HTML Cloud SDK for Java helps you work with HTML files in Java cloud applications without installing third-party software. It is a wrapper for the Aspose.HTML Cloud REST APIs.

Convert HTML, MHTML, XHTML, EPUB, Markdown, and SVG

  • HTML & XHTML -> PDF, XPS, DOCX, MD, MHTML, JPEG, BMP, PNG, TIFF, GIF
  • EPUB -> PDF, XPS, DOCX, JPEG, BMP, PNG, TIFF, GIF
  • MD -> PDF, XPS, DOCX, HTML, JPEG, BMP, PNG, TIFF, GIF
  • MHTML -> PDF, XPS, DOCX, JPEG, BMP, PNG, TIFF, GIF
  • SVG -> PDF, XPS, JPEG, BMP, PNG, TIFF, GIF

Features: Custom page size, margins, orientation, resolution, and cloud/local/URL input support.

HTML Files Cloud Storage Features

  • Upload, download, copy, move, and delete files, including versions handling (if you are using Cloud storage that supports this feature - true by default).
  • Create, copy, move, and delete folders.
  • Copy and move files and folders accross separate storages in scope of a single operation.
  • Check if certain file, folder or storage exists.

Image Vectorization

  • Convert raster images to SVG vector graphics.
  • Create high-quality vector images from low-resolution sources.
  • Adjust vectorization settings for precise results.
  • Process input from local files, URLs, or cloud storage.

Read & Write HTML Formats

HTML, zipped HTML, HTML containing SVG markup
MHTML (Web archive)
XHTML, zipped XHTML
Markdown (MD)
SVG

Save HTML As

Microsoft Word®: DOCX
Fixed Layout: PDF, XPS
Images: JPEG, PNG, BMP, TIFF, GIF
Web Formats MHTML, Markdown

Read Formats

eBook: EPUB

Requirements

Building the API client library requires:

  1. Java 1.7+
  2. Maven

Prerequisites

To use Aspose.HTML Cloud SDK for Java you need to register an account with Aspose Cloud and lookup/create Client ID and Client Secret at Cloud Dashboard. There is free quota available. For more details, see Aspose Cloud Pricing.

Installation

Install from Maven

Add Aspose Cloud repository to your application pom.xml

<repositories>
      <repository>
          <id>AsposeJavaCloudAPI</id>
          <url>https://releases.aspose.cloud/java/repo/</url>
      </repository>
  </repositories>

Install from source

To install the API client library to your local Maven repository, you can execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project’s pom.xml:

<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-html-cloud</artifactId>
    <version>22.11.1</version>
    <scope>compile</scope>
</dependency>

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/aspose-html-cloud-20.7.0.jar
  • target/lib/*.jar

Licensing

All Aspose.HTML Cloud SDKs, helper scripts and templates are licensed under MIT License.

Authorization & Authentication

Authentication schemes defined for the API is as follows:

JWT

Recommendation

It’s recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Convert HTML to JPG in Java

This example shows how to use the Aspose.HTML Cloud SDK for Java to convert an HTML file to a JPEG image. The code configures the API endpoints, authenticates with the client credentials, creates a conversion job, and saves the output locally.

// Configure Aspose Cloud API base and authentication endpoints
Configuration.setBasePath("https://api.aspose.cloud");
Configuration.setAuthPath("https://api.aspose.cloud/connect/token");

// Initialize the HTML API client with client credentials
HtmlApi api = new HtmlApi("CLIENT_ID", "CLIENT_SECRET");

// Build a conversion job: input HTML file → output JPEG
JobBuilder builder = new ConverterBuilder()
        .fromLocalFile("input.html")   // Source HTML file
        .saveToLocal("output.jpeg");   // Destination file

// Execute the conversion operation
OperationResult result = api.convert(builder);

Product Page | Documentation | Live Demo | Swagger UI | Code Samples | Blog | Free Support | Free Trial

VersionRelease Date
22.12.1December 5, 2022
22.11.1November 8, 2022
22.9.1October 12, 2022
20.7.0July 23, 2020