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");
	}

}
相关推荐
今天头发还在吗3 分钟前
【Docker】在项目中如何实现Dockerfile 文件编写
java·docker·容器
1710orange6 分钟前
java设计模式:动态代理
java·开发语言·设计模式
来碗原味的小米粥吧32 分钟前
sql题目基础50题
linux·数据库·sql
聪明的笨猪猪1 小时前
Java “并发工具类”面试清单(含超通俗生活案例与深度理解)
java·经验分享·笔记·面试
whltaoin1 小时前
Spring Boot 常用注解分类整理(含用法示例)
java·spring boot·后端·注解·开发技巧
de之梦-御风1 小时前
【Linux】 MediaMTX测试是否运行
linux·运维·服务器
卷Java2 小时前
用户权限控制功能实现说明
java·服务器·开发语言·数据库·servlet·微信小程序·uni-app
从零开始学习人工智能2 小时前
Spring Security 实战:彻底解决 CORS 跨域凭据问题与 WebSocket 连接失败
java·websocket·spring
Dovis(誓平步青云)2 小时前
《Linux 进程(1)概念入门:从 “运行的程序” 到核心定义》
linux·运维·服务器
winrisef2 小时前
删除无限递归文件夹
java·ide·python·pycharm·系统安全