diff --git a/src/main/java/com/emr/service/batchExport/BatchExportServiceImpl.java b/src/main/java/com/emr/service/batchExport/BatchExportServiceImpl.java index 400856b..acc833c 100644 --- a/src/main/java/com/emr/service/batchExport/BatchExportServiceImpl.java +++ b/src/main/java/com/emr/service/batchExport/BatchExportServiceImpl.java @@ -257,7 +257,7 @@ public class BatchExportServiceImpl implements BatchExportService { bis = new BufferedInputStream(new ByteArrayInputStream(file1)); //输出 int len = 0; - byte[] buf = new byte[100 * 1024]; + byte[] buf = new byte[1024 * 1024]; while ((len = bis.read(buf, 0, buf.length)) != -1) { bos.write(buf, 0, len); } diff --git a/src/main/java/com/emr/util/img2PdfUtil.java b/src/main/java/com/emr/util/img2PdfUtil.java index be046fc..7f2e2bd 100644 --- a/src/main/java/com/emr/util/img2PdfUtil.java +++ b/src/main/java/com/emr/util/img2PdfUtil.java @@ -468,6 +468,8 @@ public class img2PdfUtil { PdfStamper stamper = null; try { reader = new PdfReader(bos.toByteArray()); + // PDF总页数 + int total = reader.getNumberOfPages(); // 加完水印的文件 if (null != response) { stamper = new PdfStamper(reader, response.getOutputStream()); @@ -476,8 +478,7 @@ public class img2PdfUtil { } // 设置字体 BaseFont font = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.EMBEDDED); - // PDF总页数 - int total = reader.getNumberOfPages() + 1; + // 循环对每页插入水印 PdfContentByte content; PdfGState gs = new PdfGState(); @@ -523,17 +524,17 @@ public class img2PdfUtil { // 底部水印 content.endText(); //第二水印 - content.beginText(); + //content.beginText(); //16进制颜色转color - content.setColorFill(color); + //content.setColorFill(color); // 设置字体及字号 - content.setFontAndSize(font, textSize); + //content.setFontAndSize(font, textSize); // 设置起始位置 - content.setTextMatrix(textX, textY); + //content.setTextMatrix(textX, textY); // 中间水印 - content.showTextAligned(Element.ALIGN_LEFT, text, textX, textY, textRotation); + //content.showTextAligned(Element.ALIGN_LEFT, text, textX, textY, textRotation); // 底部水印 - content.endText(); + //content.endText(); } } } catch (IOException | DocumentException e) {