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

}
相关推荐
鹓于2 分钟前
Excel图片批量插入与文件瘦身
java·服务器·数据库
馨谙2 分钟前
Linux 安全文件传输完全指南:sftp 与 scp 的深度解析引言
linux·运维·服务器
鬼火儿4 分钟前
Redis Desktop Manager(Redis可视化工具)安装
java·后端
姓蔡小朋友4 分钟前
Linux网络操作
linux·运维·服务器
凛_Lin~~17 分钟前
安卓接入Twitter三方登录
android·java·twitter
ᐇ95918 分钟前
Java核心概念深度解析:从包装类到泛型的全面指南
java·开发语言
cngm11025 分钟前
若依分离版前端部署在tomcat刷新404的问题解决方法
java·前端·tomcat
linmengmeng_131429 分钟前
【Centos】服务器硬盘扩容之新加硬盘扩容到现有路径下
linux·服务器·centos
边疆.31 分钟前
【Linux】版本控制器Git和调试器—gdb/cgdb的使用
linux·服务器·git·gdb调试·cgdb
华如锦33 分钟前
使用SSE进行实时消息推送!替换WebSocket,轻量好用~
java·开发语言·网络·spring boot·后端·websocket·网络协议