/\*\*
\* word 转 pdf
\*
\* @param wordFilePath word文件路径
\* @param pdfFilePath pdf文件路径
\*/
public static void convert(String wordFilePath, String pdfFilePath) {
FileOutputStream fileOutputStream = null;
try {
pdfFilePath = pdfFilePath == null ? getPdfFilePath(wordFilePath) : pdfFilePath;
setLicense();
File file = new File(pdfFilePath);
fileOutputStream = new FileOutputStream(file);
Document doc = new Document(wordFilePath);
doc.save(fileOutputStream, SaveFormat.PDF);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
assert fileOutputStream != null;
fileOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
4.2 ExcelToPdfUtil