java word 轉pdf(aspose)


/**
* word 轉pdf
*
* @param source 輸入文件 源 doc ,docx
* @param target 輸入文件 目標 pdf
*/
public static void wordToPdf(File source, File target) {
FileOutputStream os = null;
try {
os = new FileOutputStream(target);
// Address是將要被轉化的word文檔
com.aspose.words.Document doc = new com.aspose.words.Document(source.getPath());
doc.save(os, SaveFormat.PDF);

} catch (Exception e) {
e.printStackTrace();
} finally {
if (os != null) {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}

}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM