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

Converting page to png creates an empty image

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.0
    • 2.0.0
    • None

    Description

      Generating an image from PDF generated by pdfTeX-1.40.12 creates empty images (transparent images in png format, and black images in jpeg format), see pdf-nok.pdf and pdf-nok1.png files attached.
      However, pdfTeX versions 1.40.10 and 1.40.13 generate pdf files that are correctly converted to images, see pdf-ok.pdf and pdf-ok1.png files attached.

      The code used to generate the png files is the following:

      Test.java
      import java.awt.image.BufferedImage;
      import java.io.File;
      
      import org.apache.pdfbox.pdmodel.PDDocument;
      import org.apache.pdfbox.util.PDFImageWriter;
      
      public class Test {
        public static void main(String[] args) throws Exception {
          PDDocument docOk = PDDocument.load(new File("pdf-ok.pdf"));
          PDDocument docNok = PDDocument.load(new File("pdf-nok.pdf"));
      
          PDFImageWriter imagewriter = new PDFImageWriter();
          try {
            imagewriter.writeImage(docOk, "png", null, 1, 1, "pdf-ok",
      BufferedImage.TYPE_INT_RGB, 100);
            imagewriter.writeImage(docNok, "png", null, 1, 1, "pdf-nok",
      BufferedImage.TYPE_INT_RGB, 100);
          } finally {
            docOk.close();
            docNok.close();
          }
        }
      }
      

      Attachments

        1. pdf-ok1.png
          15 kB
          Lucas Satabin
        2. pdf-ok.pdf
          63 kB
          Lucas Satabin
        3. pdf-nok1.png
          4 kB
          Lucas Satabin
        4. pdf-nok.pdf
          26 kB
          Lucas Satabin

        Issue Links

          Activity

            People

              lehmi Andreas Lehmkühler
              lsatabin Lucas Satabin
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: