我有这个java代码:
try {
PDFTextStripper pdfs = new PDFTextStripper();
String textOfPDF = pdfs.getText(PDDocument.load("doc"));
doc.add(new Field(campo.getDestino(),
textOfPDF,
Field.Store.NO,
Field.Index.ANALYZED));
} catch (Exception exep) {
System.out.println(exep);
System.out.println("PDF fail");
}
并抛出这个:
11:45:07,017 WARN [COSDocument] Warning: You did not close a PDF Document
我不知道为什么,但抛出这个 1、2、3 或更多。
我发现 COSDocument 是一个类并且有 close() 方法,但我没有在任何地方使用这个类。
我有这个进口:
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.util.PDFTextStripper;
谢谢 :)