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

PDPage convertToImage generates white image with no contents

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 1.3.1, 1.4.0
    • None
    • PDModel
    • None
    • JDK 1.6.0_21

    Description

      When converting a PDPage of this pdf into an image, the resulting file is always a white image with no contents.

      The following message appeared in the log output (It doesn't seem to be a duplicate of PDFBOX-794.) :

      ERROR filter.FlateFilter - Stop reading corrupt stream

      Here's the code used to convert the image :

      @Test
      public void testConvertImage() {
      try {
      PDDocument pdDocument = PDDocument.load("pdf_causing_white_pages.pdf");
      List<PDPage> documentPageList = pdDocument.getDocumentCatalog().getAllPages();
      TestCase.assertNotNull(documentPageList);
      int pageNumber = 1;
      for (PDPage tmpPage :documentPageList)

      { BufferedImage tempImage = tmpPage.convertToImage(); ImageIO.write(tempImage,"jpeg", new File("result_"+pageNumber+".jpeg")); pageNumber ++; }


      } catch (FileNotFoundException e)

      { TestCase.fail(e.getMessage()); } catch (IOException e) { TestCase.fail(e.getMessage()); }

      }

      Attachments

        1. PDFBOX931-pdf_causing_white_pages13.jpg
          321 kB
          Andreas Lehmkühler
        2. PDFBOX931-pdf_causing_white_pages1.jpg
          125 kB
          Andreas Lehmkühler
        3. pdf_causing_white_pages.pdf
          913 kB
          Vincent VIAL

        Issue Links

          Activity

            People

              lehmi Andreas Lehmkühler
              vincent.vial Vincent VIAL
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: