The PDF specification supports JPEG data directly, so you can just put the JPEG directly into the PDF. But it doesn’t support PNG data directly so the image data must be read out of the PNG image and only the necessary parts added into the PDF. For the image data itself, the way a PNG stores the data is with a byte prefixed to the beginning of each row that indicates the predictor that was used. So in Debenu Quick PDF Library 7.18 and earlier this byte had to be removed – essentially converting the PNG into a “bitmap” format which is really just the raw byte data.

For version 7.19 we added the ability for Debenu Quick PDF Library to add the image data as it appears in the PNG (with the predictor bytes) directly to the PDF by making use of an additional entry in the image dictionary specifying that a PNG predictor is being used in the data.

However this doesn’t work for all PNG images. For example, the image data inside PNG images that are interlaced cannot be added directly to the PDF because the PDF specification doesn’t support interlaced image data.

Regarding the compression of the image data, all the PNG code (even in earlier versions of the PDF library) have been set up to always compress the image data, so you shouldn’t see uncompressed image data, but we will examine the images and documents sent to us which appear to have uncompressed image data to identify why this is the case.

So in summary:

  1. PDF doesn’t support PNG images directly so the image data must always be converted.
  2. In Debenu Quick PDF Library 7.19 we added extra functionality to keep as much of the original PNG data as possible by adding support for PNG predictors.
  3. Debenu Quick PDF Library should always keep PNG image data in compressed format and we can’t say why there is uncompressed data without examine the files first.

Send your PDF and PNG images to our support team if you believe that adding a PNG image has made your PDF unusually large.