<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

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 3D file formats within your cloud-based Java Apps, without installing any 3rd party software. It is a wrapper around Aspose.HTML Cloud REST APIs.

HTML Cloud Processing Features

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.

Read & Write HTML Formats

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

Save HTML As

Microsoft Word®: DOCX
Fixed Layout: PDF, XPS
Images: TIFF, JPEG, PNG, BMP

Read HTML 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

<repository>
	<id>AsposeJavaAPI</id>
	<name>Aspose Java API</name>
	<url>https://releases.aspose.cloud/java/repo/</url>
</repository>

Install from source

To install the API client library to your local Maven repository, simply 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:

<dependency>
	<groupId>com.aspose</groupId>
	<artifactId>aspose-html-cloud</artifactId>
	<version>20.7.0</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.

HTML to JPG in Java

// Get your ClientId and ClientSecret from https://dashboard.aspose.cloud (free registration required).

Configuration.setAPP_SID("MY_CLIENT_ID");
Configuration.setAPI_KEY("MY_CLIENT_SECRET");
Configuration.setBasePath("https://api.aspose.cloud/v3.0");
Configuration.setAuthPath("https://api.aspose.cloud/connect/token");
Configuration.setUserAgent("WebKit");
Configuration.setDebug(true);
Configuration.setTestSrcDir("My_Source_Folder");
Configuration.setTestDstDir("My_Output_Folder");

ConversionApi conversionApi = new ApiClient().createService(ConversionApi.class);

String name = "test.html";// Document name. Place the html document in the folder "testdata".
String outFormat = "jpg"; // Convert to jpg

Integer width = 800; // Resulting image width.
Integer height = 1000; // Resulting image height.
Integer leftMargin = 10; // Left resulting image margin.
Integer rightMargin = 10; // Right resulting image margin.
Integer topMargin = 10; // Top resulting image margin.
Integer bottomMargin = 10; // Bottom resulting image margin.
Integer resolution = 300; // Resolution of resulting image.
String folder = "/"; // The folder in the storage. Should exist.
String storage = "My_Storage_Name"; // Name of the storage. null

// Prepare call execute
Call<ResponseBody> call = conversionApi.GetConvertDocumentToImage(name, outFormat, width, height, leftMargin, rightMargin, topMargin, bottomMargin, resolution, folder, storage);

// Execute request
Response<ResponseBody> img = call.execute();

// Get body from response
ResponseBody answer = img.body();

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