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

cannot load jpg into new pdf

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.4, 1.8.5, 2.0.0
    • 1.8.5, 2.0.0
    • None
    • Java 1.7, eclipse, also tried 1.8.5 and 2.0.0

    Description

      When trying to load jpg, tif or png get error below. Document is created but either gives "out of memory error" or "cannot display image" when document is opened.

      Tried: jpg or jpeg
      multiple resolutions
      compression or no compression
      creating a fresh image in gimp
      grayscale or rgb
      downloading an image from google images
      reading data into byte array and using byteinput stream

      nothing will allow me to load an image into the doc - all same result as below

      Apr 13, 2014 1:50:02 PM org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage getColorSpace
      INFO: About to return NULL from unhandled branch. filter = COSName

      {DCTDecode}

      doc = new PDDocument();
      PDPage page = new PDPage();
      FileInputStream in = new FileInputStream ("logo.jpg");
      DEBUG OUTPUT APPEARS AFTER EXEC OF THIS LINE:
      PDXObjectImage img = new PDJpeg (doc, in);
      PDPageContentStream cs = new PDPageContentStream(doc, page);
      cs.drawImage(img, 72.0f, 720.0f);

      Attachments

        1. logo.pdf
          3 kB
          Tilman Hausherr
        2. logo.jpg
          3 kB
          shaun neal

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            tilman Tilman Hausherr
            catdsnny shaun neal
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment