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