瀏覽代碼

pdf未正常关闭

wukai 1 年之前
父節點
當前提交
4c92e1f82d
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      doc-common/src/main/java/com/doc/common/utils/FileContentUtils.java

+ 1 - 2
doc-common/src/main/java/com/doc/common/utils/FileContentUtils.java

@@ -77,8 +77,7 @@ public class FileContentUtils {
      */
     public static String getContentPdf(byte[] data) {
         StringBuilder result = new StringBuilder();
-        try {
-            PDDocument load = PDDocument.load(data);
+        try (PDDocument load = PDDocument.load(data)) {
             PDFTextStripper stripper = new PDFTextStripper();
             stripper.setSortByPosition(true);
             for (int i = 1; i < load.getNumberOfPages() + 1; i++) {