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

liu updated PDFBOX-5626:
------------------------
    Description: 
jvm:-Xmx600m

demo:
public static void main(String[] args) throws IOException, InterruptedException 
{
                File file = new File("D:\\qys\\需求\\CA资料\\PDF版\\image2.pdf");

                final PDDocument load = PDDocument.load(file, 
MemoryUsageSetting.setupTempFileOnly());
                PDFRenderer renderer = new PDFRenderer(load);
                int pageIndex = 0;
                float scale = 0.5f;
                try {

                        BufferedImage bufferedImage = 
renderer.renderImage(pageIndex, scale, ImageType.RGB);
                        FileOutputStream fos = null;
                        try {
                                fos = new FileOutputStream(new 
File("D:\\fcs\\test/test6/image" + pageIndex + ".jpg"));
                                ImageIO.write(bufferedImage, "jpg", fos);
                        } finally {
                                if (fos != null) {
                                        fos.close();
                                }
                        }
                } catch (Exception e) {
                        System.out.println(e);
                }
        }

> java.lang.OutOfMemoryError: Java heap space
> -------------------------------------------
>
>                 Key: PDFBOX-5626
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5626
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: liu
>            Priority: Major
>             Fix For: 2.0.28
>
>         Attachments: image2.pdf
>
>
> jvm:-Xmx600m
> demo:
> public static void main(String[] args) throws IOException, 
> InterruptedException {
>               File file = new File("D:\\qys\\需求\\CA资料\\PDF版\\image2.pdf");
>               final PDDocument load = PDDocument.load(file, 
> MemoryUsageSetting.setupTempFileOnly());
>               PDFRenderer renderer = new PDFRenderer(load);
>               int pageIndex = 0;
>               float scale = 0.5f;
>               try {
>                       BufferedImage bufferedImage = 
> renderer.renderImage(pageIndex, scale, ImageType.RGB);
>                       FileOutputStream fos = null;
>                       try {
>                               fos = new FileOutputStream(new 
> File("D:\\fcs\\test/test6/image" + pageIndex + ".jpg"));
>                               ImageIO.write(bufferedImage, "jpg", fos);
>                       } finally {
>                               if (fos != null) {
>                                       fos.close();
>                               }
>                       }
>               } catch (Exception e) {
>                       System.out.println(e);
>               }
>       }



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to