<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-html-cloud</artifactId>
<version>22.9.1</version>
</dependency>
compile(group: 'com.aspose', name: 'aspose-html-cloud', version: '22.9.1')
<dependency org="com.aspose" name="aspose-html-cloud" rev="22.9.1">
<artifact name="aspose-html-cloud" ext="jar"/>
</dependency>
libraryDependencies += "com.aspose" % "aspose-html-cloud" % "22.9.1"
HTML Rendering & Conversion Java Cloud REST API
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
- Convert HTML page to supported file formats. – HTML to PDF Conversion – HTML to DOCX Conversion – HTML to XPS Conversion – HTML to image conversion – HTML to Markdown Conversion
- Configure HTML conversion options to fetch the best result output.
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:
- Java 1.7+
- 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
- Type: OAuth
- Flow: application
- Authorization URL: https://api.aspose.cloud/connect/token
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
File | Classifier | Size |
---|---|---|
aspose-html-cloud-22.9.1-javadoc.jar | javadoc | 248 KB |
aspose-html-cloud-22.9.1.jar | 59 KB | |
aspose-html-cloud-22.9.1.pom | 9 KB |
Aspose.HTML Aspose.HTML Cloud Aspose Java REST API Maven SDK Java SDK Cloud REST REST API Cloud API MIT JWT oauth Aspose.Total Cloud HTML XHTML zipped HTML zipped XHTML MHTML HTML SVG markup Markdown JSON EPUB XML SVG PDF XPS TIFF JPEG PNG BMP GIF TXT ZIP resource convert conversion converter export exporter css fragments template request body HTML to PDF HTML to DOCX HTML to xps HTML to image HTML to markdown HTML to MD XPath