You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "liu (Jira)" <ji...@apache.org> on 2023/10/18 06:57:00 UTC
[jira] (PDFBOX-5675) org.apache.pdfbox.filter.Filter#decode() Java heap space
[ https://issues.apache.org/jira/browse/PDFBOX-5675 ]
liu deleted comment on PDFBOX-5675:
-----------------------------
was (Author: JIRAUSER297279):
写的时候可以加条件吗? 当发现总写入数据超过指定大小,如50MB时,基于临时文件节省内存。
> 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, image-2023-09-05-15-05-50-168.png, image.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-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org