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

}
相关推荐
Galeoto1 分钟前
how to setup k3s on an offline ubuntu
linux·运维·ubuntu
龙卷风040511 分钟前
SpringAI调用第三方模型增加自定义请求参数
java·后端
java1234_小锋11 分钟前
RabbitMQ如何实现消息的持久化?
java·rabbitmq·java-rabbitmq
二进制coder18 分钟前
深入解析 AST2600 H2B 接口:架构、原理与完整开发指南
linux·架构
tqs_123451 小时前
redis zset score的计算
java·算法
kaili2301 小时前
IDEA试用过期,无法登录,重置方法
java·intellij-idea
没有bug.的程序员1 小时前
Redis 内存优化与压缩:从原理到实战的完整指南
java·数据库·redis·内存优化·压缩内存
sainty071 小时前
linux 宏 DEVICE_ATTR
linux
ajassi20001 小时前
linux C 语言开发 (六) 程序的编辑和编译(vim、gcc)
linux·运维·服务器