|
|
@@ -110,35 +110,7 @@ public class PDFUtils {
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 将Word文档转换为图片后再导出为PDF并提供下载
|
|
|
- *
|
|
|
- * @param wordFilePath Word文件路径
|
|
|
- * @param response HttpServletResponse对象
|
|
|
- * @param pdfFileName 生成的PDF文件名
|
|
|
- * @param uploadPath 上传路径
|
|
|
- * @throws Exception
|
|
|
- */
|
|
|
- public static void convertWordToImagesToPDFForDownload(String wordFilePath,
|
|
|
- javax.servlet.http.HttpServletResponse response,
|
|
|
- String pdfFileName,
|
|
|
- String uploadPath) throws Exception {
|
|
|
- String realFileName = uploadPath + "/tmp/" + System.currentTimeMillis() + ".pdf";
|
|
|
|
|
|
- // 转换Word为图片再导出为PDF
|
|
|
- convertWordToImagesToPDF(wordFilePath, realFileName);
|
|
|
-
|
|
|
- // 设置响应头,用于文件下载
|
|
|
- com.goafanti.common.utils.excel.FileUtils.setAttachmentResponseHeader(
|
|
|
- response, pdfFileName, pdfFileName + ".pdf");
|
|
|
-
|
|
|
- // 提供文件下载
|
|
|
- com.goafanti.common.utils.excel.FileUtils.writeBytes(
|
|
|
- realFileName, response.getOutputStream());
|
|
|
-
|
|
|
- // 删除临时文件
|
|
|
- com.goafanti.common.utils.excel.FileUtils.deleteFile(realFileName);
|
|
|
- }
|
|
|
|
|
|
|
|
|
/**
|