資源簡介
破解版Aspose,excel轉pdf沒水印,word水印沒法去除 ,技術文檔+jar包資源都壓縮在一起,親測可用,歡迎下載
代碼片段和文件信息
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應放在..\WebRoot\WEB-INF\classes路徑下
????????????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--pdf\aspose-cells-8.5.2.jar
?????文件???10269481??2018-08-27?16:33??excel+word--pdf\aspose-words-15.8.0-jdk16.jar
?????文件???15416985??2018-08-28?10:22??excel+word--pdf\excel_word轉換成pdf使用文檔說明.docx
?????文件????????584??2018-08-27?16:24??excel+word--pdf\license.xm
?????文件???????2649??2018-08-28?10:14??excel+word--pdf\MainTest.java
?????文件????????594??2018-08-28?10:20??excel+word--pdf\pom引入jar包方式.txt
?????目錄??????????0??2018-08-28?10:22??excel+word--pdf
-----------?---------??----------?-----??----
?????????????31753229????????????????????7
- 上一篇:掃描全能王 已付費版
- 下一篇:JAVA核心技術 第9版
評論
共有 條評論