[ https://issues.apache.org/jira/browse/PDFBOX-5675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17840627#comment-17840627 ]
Axel Howind commented on PDFBOX-5675: ------------------------------------- Here, you insert a new parameter right between existing ones: {code:java} public static RandomAccessRead decode(InputStream encoded, List<Filter> filterList, - COSDictionary parameters, DecodeOptions options, List<DecodeResult> results) + COSDictionary parameters, RandomAccessStreamCache streamCache, DecodeOptions options, List<DecodeResult> results) {code} I suggest to instead move the new parameter to the end and also offer an overload so that users do not have to change their code - this is for 3.0 so there should be no breaking changes. That basically means that you should move the streamCache to the end of the parameter list and also add this overload that calls the new code: {code:java} public static RandomAccessRead decode(InputStream encoded, List<Filter> filterList, COSDictionary parameters, DecodeOptions options, List<DecodeResult> results) { return decode(encoded, filterList, parameters, options, results, <whatever the default for streamCache should be>) } {code} > org.apache.pdfbox.filter.Filter#decode() Java heap space > -------------------------------------------------------- > > Key: PDFBOX-5675 > URL: https://issues.apache.org/jira/browse/PDFBOX-5675 > Project: PDFBox > Issue Type: Bug > Affects Versions: 3.0.0 PDFBox > Reporter: liu > Priority: Major > Attachments: 2095e3df01fc32e0bff982a1e79600d5bcf10b81.pdf, > PDFBOX-5675.patch, image-2023-09-05-15-05-50-168.png, > image-2024-04-24-16-50-38-925.png, image-2024-04-24-18-33-17-524.png, > image-2024-04-24-18-35-43-792.png, image-2024-04-24-19-25-22-904.png, > image.png, screenshot-1.png, screenshot-2.png > > > !image-2023-09-05-15-05-50-168.png! > When converting the sixth page of this PDF > file(2095e3df01fc32e0bff982a1e79600d5bcf10b81.pdf) to an image, a memory > overflow occurs. Can you provide a way to store the output in a temporary > file? > {code:java} > -Xmx2000m > public static void main(String[] args) throws IOException, > InterruptedException { > File file = new > File("D:\\2095e3df01fc32e0bff982a1e79600d5bcf10b81.pdf"); > PDDocument pdf = Loader.loadPDF(file, > IOUtils.createTempFileOnlyStreamCache()); > pdf.setResourceCache(new PdfboxResourceCache()); > PDFRenderer renderer = new PDFRenderer(pdf); > renderer.setSubsamplingAllowed(true); > BufferedImage bi = renderer.renderImage(5, 0.125f); > Thread.sleep(3600000); > pdf.close(); > } > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org