问题描述
我用pdfbox做pdf转jpg图片的时候。报了如下错误在加载PDF文件请等待...org.apache.pdfbox.exceptions.WrappedIOExceptionatorg.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:238)atorg.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:862)atorg.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:829)atorg.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:800)atcom.p2j.P2JChanger.getPageNums(P2JChanger.java:30)atcom.p2j.P2JChanger.excute(P2JChanger.java:55)atcom.p2j.P2J.main(P2J.java:42)Causedby:java.lang.OutOfMemoryError:Javaheapspaceatorg.apache.pdfbox.io.RandomAccessBuffer.write(RandomAccessBuffer.java:117)atorg.apache.pdfbox.io.RandomAccessFileOutputStream.write(RandomAccessFileOutputStream.java:108)atjava.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)atjava.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)atjava.io.FilterOutputStream.close(FilterOutputStream.java:140)atorg.apache.pdfbox.pdfparser.BaseParser.parseCOSStream(BaseParser.java:448)atorg.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:542)atorg.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:180)...6more在网上查了一下,好像是要安装patch补丁,补丁内容如下。Index:src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java===================================================================---src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java(revision773978)+++src/main/java/org/apache/pdfbox/pdfparser/BaseParser.java(workingcopy)@@-351,6+351,11@@byte[]buffer=newbyte[ENDSTREAM.length];intnextIdx=pdfSource.read(buffer)%buffer.length;+if(nextIdx<0){+pdfSource.unread(ENDSTREAM);+return;+}+while(byteRead!=-1){if(cmpCircularBuffer(buffer,(nextIdx-ENDSTREAM.length+buffer.length)%buffer.length,ENDSTREAM)){pdfSource.unread(ENDSTREAM);请问我怎么安装,这个补丁到。我的pdfbox.jar文件中。来修复这个问题