You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "OttoMP (JIRA)" <ji...@apache.org> on 2011/05/31 01:51:47 UTC

[jira] [Updated] (PDFBOX-1023) Getting image with black background when converting from PDF to Image!!

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

OttoMP updated PDFBOX-1023:
---------------------------

    Description: 
Everytime I try to conver a PDF file with a graphic on it, to Image (PNG) I get a black background beneath the graphic, where the background is white originally, here's my code:
            
            PDDocument document = PDDocument.load(new File("C:\\export_settings\\testReport.pdf"));
            List<PDPage> pages = document.getDocumentCatalog().getAllPages();

            for (int i = 0; i < pages.size(); i++) {
                PDPage singlePage = pages.get(i);
                BufferedImage buffImage =  singlePage.convertToImage();
                ImageIO.write(buffImage, "PNG", new File("C:\\export_settings\\page" + i + ".png"));
            }

The image quality is good, except for this, I tried with two different methos but I got the same result, please help me, thanks!

  was:
Everytime I try to conver a PDF file with a graphic on it, to Image (PNG) I get a black background beneath the graphic, here's my code:
            
            PDDocument document = PDDocument.load(new File("C:\\export_settings\\testReport.pdf"));
            List<PDPage> pages = document.getDocumentCatalog().getAllPages();

            for (int i = 0; i < pages.size(); i++) {
                PDPage singlePage = pages.get(i);
                BufferedImage buffImage =  singlePage.convertToImage();
                ImageIO.write(buffImage, "PNG", new File("C:\\export_settings\\page" + i + ".png"));
            }

The image quality is good, except for this, I tried with two different methos but I got the same result, please help me, thanks!


> Getting image with black background when converting from PDF to Image!!
> -----------------------------------------------------------------------
>
>                 Key: PDFBOX-1023
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1023
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.5.0
>         Environment: Microsoft Windows 7 Ultimate, jDeveloper 10g
>            Reporter: OttoMP
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Everytime I try to conver a PDF file with a graphic on it, to Image (PNG) I get a black background beneath the graphic, where the background is white originally, here's my code:
>             
>             PDDocument document = PDDocument.load(new File("C:\\export_settings\\testReport.pdf"));
>             List<PDPage> pages = document.getDocumentCatalog().getAllPages();
>             for (int i = 0; i < pages.size(); i++) {
>                 PDPage singlePage = pages.get(i);
>                 BufferedImage buffImage =  singlePage.convertToImage();
>                 ImageIO.write(buffImage, "PNG", new File("C:\\export_settings\\page" + i + ".png"));
>             }
> The image quality is good, except for this, I tried with two different methos but I got the same result, please help me, thanks!

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira