Browse Source

word/excel导出PDF与PDF合并开发

anderx 5 months ago
parent
commit
a498dc66d9
1 changed files with 0 additions and 28 deletions
  1. 0 28
      src/main/java/com/goafanti/common/utils/pdf/PDFUtils.java

+ 0 - 28
src/main/java/com/goafanti/common/utils/pdf/PDFUtils.java

@@ -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);
-    }
 
 
     /**