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

}
相关推荐
KK溜了溜了1 分钟前
JAVA-springboot 整合Redis
java·spring boot·redis
天河归来11 分钟前
使用idea创建springboot单体项目
java·spring boot·intellij-idea
漫步企鹅22 分钟前
【蓝牙】Linux Qt4查看已经配对的蓝牙信息
linux·qt·蓝牙·配对
weixin_4786897628 分钟前
十大排序算法汇总
java·算法·排序算法
码荼31 分钟前
学习开发之hashmap
java·python·学习·哈希算法·个人开发·小白学开发·不花钱不花时间crud
cui_win33 分钟前
【网络】Linux 内核优化实战 - net.core.flow_limit_table_len
linux·运维·网络
梦在深巷、34 分钟前
MySQL/MariaDB数据库主从复制之基于二进制日志的方式
linux·数据库·mysql·mariadb
IT_102443 分钟前
Spring Boot项目开发实战销售管理系统——数据库设计!
java·开发语言·数据库·spring boot·后端·oracle
冰橙子id1 小时前
linux系统安全
linux·安全·系统安全
stark张宇1 小时前
VMware 虚拟机装 Linux Centos 7.9 保姆级教程(附资源包)
linux·后端