You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (Jira)" <ji...@apache.org> on 2023/12/27 13:07:00 UTC

[jira] [Closed] (PDFBOX-5218) PDF to Image, Why is the larger the heap memory setting, the larger the parsing footprint

     [ https://issues.apache.org/jira/browse/PDFBOX-5218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler closed PDFBOX-5218.
--------------------------------------
    Resolution: Invalid

Closed as the user never provided any feedback.

[~lanshiqin] feel free to reopen if any update is available

> PDF to Image, Why is the larger the heap memory setting, the larger the parsing footprint
> -----------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-5218
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5218
>             Project: PDFBox
>          Issue Type: Improvement
>    Affects Versions: 2.0.24
>         Environment: jdk1.8
> windows 10
> linux
> macOS
>            Reporter: lanshiqin
>            Priority: Major
>
> Why is the larger the heap memory setting, the larger the parsing footprint
> -Xmx8g, Use 4g at most
> -Xmx1g, Use 600MB at most
> It is bug?
> [PDF File|https://gitee.com/lanshiqin/web-demo/raw/master/src/main/resources/static/Max_PDF_DEMO.pdf]
>  
> {code:java}
> public class Demo {
>     public static void main(String[] args) throws Exception {
>         String pdfUrl = "file:///D:\\xxxx.pdf";
>         InputStream in = new URL(pdfUrl).openStream();
>         PDDocument document = PDDocument.load(in, MemoryUsageSetting.setupTempFileOnly());
>         document.setResourceCache(null);
>         PDFRenderer renderer = new PDFRenderer(document);
>         renderer.setSubsamplingAllowed(true);
>         for (int i = 0; i < document.getNumberOfPages(); i++) {
>             BufferedImage bufferedImage = renderer.renderImageWithDPI(i, 100);
>             try {
>                 System.out.println("current is : " + i);
>             } finally {
>                 bufferedImage.getGraphics().dispose();
>             }
>         }
>         document.close();
>         in.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