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

HTML 呈现和转换 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 帮助您在基于云的 Java 应用程序中处理 3D 文件格式,而无需安装任何第 3 方软件。它是 Aspose.HTML Cloud REST APIs 的包装器。

HTML 云处理功能

HTML 文件云存储功能

  • 上传、下载、复制、移动和删除文件,包括版本处理(如果您使用的是支持此功能的云存储 - 默认情况下为真)。
  • 创建、复制、移动和删除文件夹。
  • 在单个操作范围内跨不同存储复制和移动文件和文件夹。
  • 检查某个文件、文件夹或存储是否存在。

读写 HTML 格式

HTML、压缩 HTML、包含 SVG 标记的 HTML
MHTML(网络存档)
XHTML,压缩 XHTML
降价(MD)

将 HTML 另存为

Microsoft Word®: DOCX
固定布局: PDF、XPS
图像: TIFF、JPEG、PNG、BMP

阅读 HTML 格式

电子书: EPUB

要求

构建 API 客户端库需要:

  1. Java 1.7+
  2. 行家

先决条件

要使用 Aspose.HTML Cloud SDK for Java,您需要在 Aspose Cloud 注册一个帐户并在 Cloud Dashboard 查找/创建客户端 ID 和客户端密码。有可用的免费配额。有关详细信息,请参阅Aspose Cloud Pricing

安装

从 Maven 安装

将 Aspose Cloud 存储库添加到您的应用程序 pom.xml

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

从源安装

要将 API 客户端库安装到本地 Maven 存储库,只需执行:

mvn clean install

要将其部署到远程 Maven 存储库,请配置存储库的设置并执行:

mvn clean deploy

有关更多信息,请参阅 OSSRH Guide

Maven 用户

将此依赖项添加到项目的 POM 中:

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

### 其他

首先通过执行生成JAR:

mvn clean package

然后手动安装以下 JAR:

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

许可

所有 Aspose.HTML Cloud SDK、帮助程序脚本和模板均根据 MIT License 获得许可。

授权与认证

Authentication schemes API定义如下:

###智威汤逊

推荐

建议在多线程环境中为每个线程创建一个“ApiClient”实例,以避免任何潜在问题。

Java 中的 HTML 到 JPG

// 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.11.12022年11月8日
22.9.12022年10月12日
20.7.02020年7月23日