Skip to main content
Skip table of contents

PNG Image Handling

iText Core 7.1.11 introduced more robust PNG image handling to address an issue which could occur when adding certain PNG images to a PDF.

Details

  • When we use iText to add a PNG image to a document, in a few use cases we end up with a PDF file which Acrobat or other PDF viewers are unable to open.
  • Certain PNG images with Indexed colorspace to a PDF document resulted in a corrupted PDF. The reason for this issue is that if during deserialization the attributes of the image's colorspace start with "/" (slash) character, then we should translate it to a PdfName object. However that is not true for some attributes. 
  • Prior to iText 7.1.11, iText parsed it incorrectly into a PdfName object, resulting in a corrupted PDF.
  • After fixing this problem , iText generates the PdfStream object with the correct image's info inside.

Below is an example demonstrating the new behavior:

##GITHUB:https://github.com/RagvendraSingh/releaseexample/blob/master/FixPNGIssue.java##

##GITHUB:https://github.com/RagvendraSingh/releaseexample/blob/master/FixPNGIssue.cs##



JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.