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

saved pdf causes "insufficient data for an image when opened with Adobe Acrobat Reader 9.2.0

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 1.2.1
    • 1.2.1
    • Writing
    • None
    • Windows XP sp3 x86

    Description

      I create a buffered image as:

      BufferedImage bf = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);

      I draw various thing to the graphics of bf .

      I then use bf in the following:

      PDDocument pdDocument = new PDDocument();
      // loop
      BufferedImage image = myObject.toBufferedImage(); // returns the bf from above
      PDPage pdPage = new PDPage(new PDRectangle(image.getWidth() + border * 2, image.getHeight() + border * 2));
      pdPage.setRotation(myObject.getRotation()); // getRotation() is an int and a multiple of 90
      contentStream = new PDPageContentStream(pdDocument,pdPage,false,false);
      contentStream.drawImage(new PDJpeg(pdDocument,image),border,border);
      pdDocument.addPage(pdPage);
      // end loop
      pdDocument.save(outputStream = new FileOutputStream(file));

      The resulting pdf can be downloaded at

      http://www.floorsoft.com/grant/pdfbox/TestSave2.pdf

      Attachments

        Activity

          People

            Unassigned Unassigned
            modsiw Grant Overby
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: