Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-1023

Getting image with black background when converting from PDF to Image!!

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.0
    • 1.6.0
    • PDModel
    • None
    • Microsoft Windows 7 Ultimate, jDeveloper 10g

    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!

      Attachments

        1. page0.png
          12 kB
          OttoMP
        2. PDFBOX1023-testReport1.png
          55 kB
          Andreas Lehmkühler
        3. testReport.pdf
          7 kB
          OttoMP

        Activity

          People

            lehmi Andreas Lehmkühler
            saman0suke1 OttoMP
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified