repositories>
? ? <repository>
? ? ? ? <id>com.e-iceblue</id>
? ? ? ? <name>cloud</name>
? ? ? ? <url>http://repo.e-iceblue.cn/repository/maven-public/</url>
? ? </repository>
</repositories>
<dependencies>
? ? ? ? <dependency>
? ? ? ? ? ? <groupId> cloud </groupId>
? ? ? ? ? ? <artifactId>spire.cloud.sdk</artifactId>
? ? ? ? ? ? <version>3.5.0</version>
? ? ? ? </dependency>
? ? ? ? <dependency>
? ? ? ? <groupId> com.google.code.gson</groupId>
? ? ? ? <artifactId>gson</artifactId>
? ? ? ? <version>2.8.1</version>
? ? ? ? </dependency>
? ? ? ? <dependency>
? ? ? ? ? ? <groupId> com.squareup.okhttp</groupId>
? ? ? ? ? ? <artifactId>logging-interceptor</artifactId>
? ? ? ? ? ? <version>2.7.5</version>
? ? ? ? </dependency>
? ? ? ? <dependency>
? ? ? ? ? ? <groupId> com.squareup.okhttp </groupId>
? ? ? ? ? ? <artifactId>okhttp</artifactId>
? ? ? ? ? ? <version>2.7.5</version>
? ? ? ? </dependency>
? ? ? ? <dependency>
? ? ? ? ? ? <groupId> com.squareup.okio </groupId>
? ? ? ? ? ? <artifactId>okio</artifactId>
? ? ? ? ? ? <version>1.6.0</version>
? ? ? ? </dependency>
? ? ? ? <dependency>
? ? ? ? ? ? <groupId> io.gsonfire</groupId>
? ? ? ? ? ? <artifactId>gson-fire</artifactId>
? ? ? ? ? ? <version>1.8.0</version>
? ? ? ? </dependency>
? ? ? ? <dependency>
? ? ? ? ? ? <groupId>io.swagger</groupId>
? ? ? ? ? ? <artifactId>swagger-annotations</artifactId>
? ? ? ? ? ? <version>1.5.18</version>
? ? ? ? </dependency>
? ? ? ? <dependency>
? ? ? ? ? ? <groupId> org.threeten </groupId>
? ? ? ? ? ? <artifactId>threetenbp</artifactId>
? ? ? ? ? ? <version>1.3.5</version>
? ? ? ? </dependency>
</dependencies>
復(fù)制代碼
完成配置后疤祭,點(diǎn)擊“Import Changes” 即可導(dǎo)入所有需要的jar文件。如果使用的是Eclipse,可參考這里的導(dǎo)入方法愚屁。
導(dǎo)入結(jié)果:
二鄙皇、登錄冰藍(lán)云賬號(hào)胚嘲,創(chuàng)建文件夾嫌佑,上傳文檔
三杆故、創(chuàng)建應(yīng)用程序迅箩,獲取App ID及App Key
四、Java代碼示例
【示例1】繪制線條形狀
復(fù)制代碼
import spire.cloud.pdf.sdk.ApiException;
import spire.cloud.pdf.sdk.Configuration;
import spire.cloud.pdf.sdk.api.PdfPathApi;
public class DrawLine {
? ? //配置賬號(hào)信息
? ? static String appId = "App ID";
? ? static String appKey = "App Key";
? ? static String baseUrl= "https://api.e-iceblue.cn";
? ? static Configuration configuration = new Configuration(appId, appKey, baseUrl);
? ? static PdfPathApi pdfPathApi = new PdfPathApi(configuration);
? ? public static void main(String[] args) throws ApiException {
? ? ? ? String name = "samplefile.pdf";//用于測(cè)試的PDF源文檔
? ? ? ? String outPath = "output/DrawLine.pdf";//結(jié)果文檔路徑(保存在冰藍(lán)云端output文件夾下)
? ? ? ? int pageNumber = 1;//指定需要繪制線段的PDF頁(yè)面
? ? ? ? float firstPointfX = 100;//指定線段起始點(diǎn)坐標(biāo)
? ? ? ? float firstPointfY = 150;
? ? ? ? float secondPointfX = 400;
? ? ? ? float secondPointfY = 150;
? ? ? ? String folder = "input";//源文檔輸在文件夾
? ? ? ? String storage = null;//冰藍(lán)云提供的2G免費(fèi)云存儲(chǔ)空間
? ? ? ? String password = null;//源文檔密碼(無(wú)密碼設(shè)置為null)
? ? ? ? //調(diào)用方法繪制線條
? ? ? ? pdfPathApi.drawLine(name, outPath, pageNumber, firstPointfX, firstPointfY, secondPointfX, secondPointfY, folder, storage, password);
? ? }
}
復(fù)制代碼
線條繪制效果:
【示例2】繪制矩形形狀
復(fù)制代碼
import spire.cloud.pdf.sdk.ApiException;
import spire.cloud.pdf.sdk.Configuration;
import spire.cloud.pdf.sdk.api.PdfPathApi;
import spire.cloud.pdf.sdk.model.RectangleF;
public class DrawRec {
? ? //配置賬號(hào)信息
? ? static String appId = "App ID";
? ? static String appKey = "App Key";
? ? static String baseUrl= "https://api.e-iceblue.cn";
? ? static Configuration configuration = new Configuration(appId, appKey, baseUrl);
? ? static PdfPathApi pdfPathApi = new PdfPathApi(configuration);
? ? public static void main(String[] args) throws ApiException {
? ? ? ? String name = "samplefile1.pdf";//加載需要添加形狀的PDF源文檔
? ? ? ? String outPath = "output/DrawRectanglef.pdf";//指定結(jié)果文檔路徑(保存在冰藍(lán)云端output文件夾下)
? ? ? ? int pageNumber = 1;//指定需要添加形狀的PDF頁(yè)面
? ? ? ? RectangleF rect = new RectangleF();//創(chuàng)建RectangleF類的對(duì)象
? ? ? ? rect.setX(100f);//指定形狀坐標(biāo)
? ? ? ? rect.setY(100f);
? ? ? ? rect.setWidth(350f);//指定形狀寬度处铛、高度
? ? ? ? rect.setHeight(60f);
? ? ? ? String folder = "input";//源文檔所在文件夾
? ? ? ? String storage = null;//冰藍(lán)云提供的2G免費(fèi)存儲(chǔ)空間
? ? ? ? String password = null;//源文檔密碼(無(wú)密碼設(shè)置為null)
? ? ? ? //調(diào)用方法繪制矩形
? ? ? ? pdfPathApi.drawRectanglef(name, outPath, pageNumber, rect, folder, storage, password);
? ? }
}
龍華大道1號(hào)http://www.kinghill.cn/LongHuaDaDao1Hao/index.html