破解版Aspose,excel转pdf没水印,word水印没法去除 ,技术文档+jar包资源都压缩在一起,亲测可用,欢迎下载
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6062936 2018-08-27 16:13 excel+word--pdfaspose-cells-8.5.2.jar
文件 10269481 2018-08-27 16:33 excel+word--pdfaspose-words-15.8.0-jdk16.jar
文件 15416985 2018-08-28 10:22 excel+word--pdfexcel_word转换成pdf使用文档说明.docx
文件 584 2018-08-27 16:24 excel+word--pdflicense.xml
文件 2649 2018-08-28 10:14 excel+word--pdfMainTest.java
文件 594 2018-08-28 10:20 excel+word--pdfpom引入jar包方式.txt
目录 0 2018-08-28 10:22 excel+word--pdf
----------- --------- ---------- ----- ----
31753229 7
package com.zd.test;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import com.aspose.cells.License;
import com.aspose.cells.Workbook;
import com.aspose.words.Document;
public class MainTest {
public static void main(String[] args) {
// excel2pdf(“E:\personalTax.xls““E:\personalTax.pdf“);
doc2pdf(“E:\excel_word转换成pdf.docx““E:\excel_word转换成pdf.pdf“);
}
//去水印
private static boolean getLicense() {
boolean result = false;
try {
InputStream is = MainTest.class.getClassLoader().getResourceAsStream(“license.xml“); // license.xml应放在..WebRootWEB-INFclasses路径下
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
//excel转pdf
public static void excel2pdf(String excelPath String pdfPath) {
if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
return;
}
try {
long old = System.currentTimeMillis();
Workbook wb = new Workbook(excelPath);// 原始excel路径
FileOutputStream fileOS = new FileOutputStream(new File(pdfPath));
wb.save(fileOS com.aspose.cells.SaveFormat.PDF);
fileOS.close();
long now = System.currentTimeMillis();
System.out.println(“共耗时:“ + ((now - old) / 1000.0) + “秒“); //转化用时
} catch (Exception e) {
e.printStackTrace();
}
}
//word转pdf
public static void doc2pdf(String wordPath String pdfPath) {
if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
return;
}
try {
long old = System.currentTimeMillis();
File file = new File(pdfPath); //新建一个pdf文档
FileOutputStream os = new FileOutputStream(file);
Document doc = new Document(wordPath); //Address是将要被转化的word文档
doc.save(os com.aspose.words.SaveFormat.PDF);//全面支持DOC DOCX OOxml RTF HTML OpenDocument PDF EPUB XPS SWF 相互转换
long now = System.currentTimeMillis();
os.close();
System.out.println(“共耗时:“ + ((now - old) / 1000.0) + “秒“); //转化用时
} catch (Exception e) {
e.printStackTrace();
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6062936 2018-08-27 16:13 excel+word--pdfaspose-cells-8.5.2.jar
文件 10269481 2018-08-27 16:33 excel+word--pdfaspose-words-15.8.0-jdk16.jar
文件 15416985 2018-08-28 10:22 excel+word--pdfexcel_word转换成pdf使用文档说明.docx
文件 584 2018-08-27 16:24 excel+word--pdflicense.xm
文件 2649 2018-08-28 10:14 excel+word--pdfMainTest.java
文件 594 2018-08-28 10:20 excel+word--pdfpom引入jar包方式.txt
目录 0 2018-08-28 10:22 excel+word--pdf
----------- --------- ---------- ----- ----
31753229 7
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)