java 破解aspose.words 18.6 使用

资源包:https://download.csdn.net/download/qq_36598111/90787167

jar包是破解过的,直接可以使用。

引入jar,要引入本地的,不要直接引入仓库的

复制代码
<dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose-words</artifactId>
            <version>18.6</version>
        </dependency>

然后把license.xml 放在resourseces下面

直接使用就可以,注意要先验证之后才能转换

复制代码
import java.io.*;

import com.aspose.words.*;


public class DocToPdf {
	public static boolean getLicense() {
		boolean result = false;
		try {
			InputStream is = DocToPdf.class.getClassLoader()
					.getResourceAsStream("license.xml"); // license.xml应放在..\WebRoot\WEB-INF\classes路径下
			License aposeLic = new License();
			aposeLic.setLicense(is);
			result = true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return result;
	}

	public static void doc2pdf(String Address, String outPath) {

		if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
			return;
		}
		try {
			long old = System.currentTimeMillis();
			File file = new File(outPath); // 新建一个空白pdf文档
			FileOutputStream os = new FileOutputStream(file);
			Document doc = new Document(Address); // Address是将要被转化的word文档
			doc.save(os, SaveFormat.PDF);// 全面支持DOC, DOCX, OOXML, RTF HTML,
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		doc2pdf("D:/123.doc", "D:/1234.pdf");
	}

}
相关推荐
喝可乐的希饭a18 分钟前
Spring 策略模式实现
java·spring·策略模式
荒诞硬汉22 分钟前
二维数组相关学习
java·算法
Tipriest_31 分钟前
离线进行apt安装的过程(在只能本地传输的ubuntu主机上使用apt安装)
linux·运维·ubuntu·apt·install·deb
我有一只肥螳螂33 分钟前
idea监控本地堆栈
java·ide·intellij-idea
QMCY_jason38 分钟前
Ubuntu 1804 编译ffmpeg qsv MediaSDK libva 遇到的问题记录
linux·ubuntu·ffmpeg
程序员良辰1 小时前
URL与URI:互联网世界的“门牌号“与“身份证“
java·网络协议
ahauedu1 小时前
Apache POI 依赖版本冲突导致 NoSuchFieldError: Factory 报错
java·maven·apache
什么蜜桃绵绵冰1 小时前
linux易错题
linux·运维·服务器
运维帮手大橙子1 小时前
字符串缓冲区和正则表达式
java·开发语言
Mike_Wuzy1 小时前
【Linux】发展历程
linux