From c73a96151940a735dac67799d4b6cd479b70f415 Mon Sep 17 00:00:00 2001 From: linfso Date: Sun, 28 Jul 2024 16:44:18 +0800 Subject: [PATCH] md --- emis-biz-web/emis-biz-web.iml | 9 ---- emis-biz/emis-biz.iml | 9 ---- emis-biz/pom.xml | 14 +++--- .../service/impl/EmisWaybillServiceImpl.java | 9 ++-- .../erp/emis/service/warehouse/DocUtils.java | 44 +++++++++---------- 5 files changed, 35 insertions(+), 50 deletions(-) diff --git a/emis-biz-web/emis-biz-web.iml b/emis-biz-web/emis-biz-web.iml index 5629c9673..b587cac55 100644 --- a/emis-biz-web/emis-biz-web.iml +++ b/emis-biz-web/emis-biz-web.iml @@ -270,14 +270,5 @@ - - - - - - - - - \ No newline at end of file diff --git a/emis-biz/emis-biz.iml b/emis-biz/emis-biz.iml index 781b7da7a..c3ffeed96 100644 --- a/emis-biz/emis-biz.iml +++ b/emis-biz/emis-biz.iml @@ -229,14 +229,5 @@ - - - - - - - - - \ No newline at end of file diff --git a/emis-biz/pom.xml b/emis-biz/pom.xml index 567737458..f841ab799 100644 --- a/emis-biz/pom.xml +++ b/emis-biz/pom.xml @@ -152,13 +152,13 @@ 1.10.6 - - com.aspose - aspose-words - 15.8.0 - system - ${project.basedir}/lib/aspose-words-15.8.0-jdk16.jar - + + + + + + + diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java index a631cade8..3b1409474 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java @@ -2335,10 +2335,13 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb response.setHeader("Content-Disposition", "attachment;fileName=" + fileName + ".pdf"); ByteArrayOutputStream bos = new ByteArrayOutputStream(); - template.write(bos); - ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + // 写入流 +// template.write(bos); + template.write(outputStream); + +// ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); +// DocUtils.wordToPdf(bis, outputStream); - DocUtils.wordToPdf(bis, outputStream); response.flushBuffer(); IOUtils.closeQuietly(fis); diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/warehouse/DocUtils.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/warehouse/DocUtils.java index e87050bcf..f9a5da9ae 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/warehouse/DocUtils.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/warehouse/DocUtils.java @@ -1,6 +1,6 @@ package com.xdadan.erp.emis.service.warehouse; -import com.aspose.words.*; +//import com.aspose.words.*; import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.config.Configure; import com.deepoove.poi.data.PictureType; @@ -53,13 +53,13 @@ public class DocUtils { } // 查看缺少的字体 - private static class FontSubstitutionWarningCollector implements IWarningCallback { - public void warning(WarningInfo info) { - if (info.getWarningType() == WarningType.FONT_SUBSTITUTION) { - log.error("==>font miss==>{}", info.getDescription()); - } - } - } +// private static class FontSubstitutionWarningCollector implements IWarningCallback { +// public void warning(WarningInfo info) { +// if (info.getWarningType() == WarningType.FONT_SUBSTITUTION) { +// log.error("==>font miss==>{}", info.getDescription()); +// } +// } +// } /** * word转换为pdf @@ -68,24 +68,24 @@ public class DocUtils { * @throws Exception */ public static void wordToPdf(InputStream wordInput, OutputStream pdfOutput) throws Exception { - getLicense(); - //通过aspose-words.jar中的类转换文件 - Document wordDoc = new Document(wordInput); - FontSubstitutionWarningCollector callback = new FontSubstitutionWarningCollector(); - wordDoc.setWarningCallback(callback); - if(!StringUtils.isEmpty(DocUtils.FONT_PATH)) { - FontSettings.setFontsFolder(DocUtils.FONT_PATH, false); - } - PdfSaveOptions pso = new PdfSaveOptions(); - wordDoc.save(pdfOutput, pso); +// getLicense(); +// //通过aspose-words.jar中的类转换文件 +// Document wordDoc = new Document(wordInput); +// FontSubstitutionWarningCollector callback = new FontSubstitutionWarningCollector(); +// wordDoc.setWarningCallback(callback); +// if(!StringUtils.isEmpty(DocUtils.FONT_PATH)) { +// FontSettings.setFontsFolder(DocUtils.FONT_PATH, false); +// } +// PdfSaveOptions pso = new PdfSaveOptions(); +// wordDoc.save(pdfOutput, pso); } @SneakyThrows private static void getLicense() { - try (InputStream is = DocUtils.class.getClassLoader().getResourceAsStream("License.xml")) { - License license = new License(); - license.setLicense(is); - } +// try (InputStream is = DocUtils.class.getClassLoader().getResourceAsStream("License.xml")) { +// License license = new License(); +// license.setLicense(is); +// } } public static void genPdfByDocxTpl(InputStream tplStream,Map fillDataMap,OutputStream os) throws Exception {