91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

word轉(zhuǎn)pdf兩種方法的jar包和代碼,工具方法,破解認(rèn)證資源,

資源截圖

代碼片段和文件信息

package?com.shzqoa.util;

import?java.io.File;
import?java.io.FileOutputStream;
import?java.io.InputStream;
?
import?org.aspectj.weaver.ast.Test;
?
import?com.aspose.words.Document;
import?com.aspose.words.License;
import?com.aspose.words.SaveFormat;


/**
?*?@author?Administrator
?*?@version?$Id$
?*?@since
?*?@see
?*/
public?class?WordPdfUtil?{
?//此插件不需要安裝office服務(wù)但是此插件加密,如不注冊(cè)會(huì)有水印
//????public?static?void?main(String[]?args)?{
//????????//doc2pdf(“C:/Users/lss/Desktop/test.doc“);
//???? doc2pdf(“F:\\doc\\a.doc““F:\\doc\\a.pdf“);
//????}
????public?static?boolean?getLicense()?{
???? boolean?result?=?false;
????????try?{
????????????InputStream?is?=?Test.class.getClassLoader().getResourceAsStream(“l(fā)icense.xml“);?//?license.xml應(yīng)放在..\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?inPath?String?outPath)?{
//????????if?(!getLicense())?{?//?驗(yàn)證License?若不驗(yàn)證則轉(zhuǎn)化出的pdf文檔會(huì)有水印產(chǎn)生
//????????????return;
//????????}
????????try?{
????????????long?old?=?System.currentTimeMillis();
????????????File?file?=?new?File(outPath);?//?新建一個(gè)空白pdf文檔
????????????FileOutputStream?os?=?new?FileOutputStream(file);
????????????Document?doc?=?new?Document(inPath);?//?Address是將要被轉(zhuǎn)化的word文檔
????????????doc.save(os?SaveFormat.PDF);//?全面支持DOC?DOCX?OOxml?RTF?HTML?OpenDocument?PDF
?????????????????????????????????????????//?EPUB?XPS?SWF?相互轉(zhuǎn)換
????????????long?now?=?System.currentTimeMillis();
????????????System.out.println(outPath+“生成共耗時(shí):“?+?((now?-?old)?/?1000.0)?+?“秒“);?//?轉(zhuǎn)化用時(shí)
????????}?catch?(Exception?e)?{
????????????e.printStackTrace();
????????}
????}
????
????public?static?void?savedocx(String?inPath?String?outPath)?{
??????if?(!getLicense())?{?//?驗(yàn)證License?若不驗(yàn)證則轉(zhuǎn)化出的pdf文檔會(huì)有水印產(chǎn)生
??????????return;
??????}
??????try?{
??????????long?old?=?System.currentTimeMillis();
??????????File?file?=?new?File(outPath);?//?新建一個(gè)空白pdf文檔
??????????FileOutputStream?os?=?new?FileOutputStream(file);
??????????Document?doc?=?new?Document(inPath);?//?Address是將要被轉(zhuǎn)化的word文檔
??????????doc.save(os?SaveFormat.DOCX);//?全面支持DOC?DOCX?OOxml?RTF?HTML?OpenDocument?PDF
???????????????????????????????????????//?EPUB?XPS?SWF?相互轉(zhuǎn)換
??????????long?now?=?System.currentTimeMillis();
??????????System.out.println(outPath+“生成共耗時(shí):“?+?((now?-?old)?/?1000.0)?+?“秒“);?//?轉(zhuǎn)化用時(shí)
??????}?catch?(Exception?e)?{
??????????e.printStackTrace();
??????}
??}
????
}

評(píng)論

共有 條評(píng)論