1 packagecom.example.util;2 importorg.jodconverter.OfficeDocumentConverter;3 importorg.jodconverter.office.DefaultOfficeManagerBuilder;4 importorg.jodconverter.office.OfficeException;5 importorg.jodconverter.office.OfficeManager;6
7 importjava.io.File;8 importjava.util.regex.Pattern;9
10 public classOffice2PDF {11 //文件转换pdf成功后保存的地址
12 private static String SAVE_PATH = "E:/pdfFile/";13 privateOffice2PDF(){}14
15 /**
16 * 将office格式的文件转为pdf17 *@paramsourceFilePath 源文件路径18 *@return
19 */
20 public staticFile openOfficeToPDF(String sourceFilePath){21 returnoffice2pdf(sourceFilePath);22 }23
24 /**
25 * 将office文档转换为pdf文档26 *@paramsourceFilePath 原文件路径27 *@return
28 */
29 public staticFile office2pdf(String sourceFilePath){30 OfficeManager officeManager = null;31 try{32 if(StringUtil.isEmpty(sourceFilePath))33 {34 //打印日志...
<