[ https://issues.apache.org/jira/browse/PDFBOX-5392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17509395#comment-17509395 ]
Tilman Hausherr commented on PDFBOX-5392: ----------------------------------------- The current version is 2.0.25. However the real problem is elsewhere: your PDF has 73 pages. 70 pages of it have the resources of ALL these 70 pages, which is a bad practice. Your PDF has a size of 18 MB. I tried to split it, and each individual split PDF (except 71, 72 and 73) has a size of 18 MB. So instead of splitting and re-merging, the best strategy would be to delete the pages you don't need with {{PDDocument.removePage()}}. > java.lang.OutOfMemoryError: Java heap space during ScratchFileBuffer#addPage > ---------------------------------------------------------------------------- > > Key: PDFBOX-5392 > URL: https://issues.apache.org/jira/browse/PDFBOX-5392 > Project: PDFBox > Issue Type: Bug > Reporter: 黄文杰 > Priority: Major > Attachments: 问题文件.pdf > > > 在对一个73页的pdf文件,进行拆分单页pdf文件,再重新进行合并时,内存溢出了 > java.lang.OutOfMemoryError: Java heap space > at > org.apache.pdfbox.io.ScratchFileBuffer.addPage(ScratchFileBuffer.java:132) > at > org.apache.pdfbox.io.ScratchFileBuffer.ensureAvailableBytesInPage(ScratchFileBuffer.java:184) > at > org.apache.pdfbox.io.ScratchFileBuffer.write(ScratchFileBuffer.java:236) > at org.apache.pdfbox.io.ScratchFile.createBuffer(ScratchFile.java:423) > at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:970) > at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:891) > at > org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:259) -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org