Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The color depth 1 is not supported

Tags:

itext

I am using iTextSharp version 5.5.2.0 and when trying to load the attached pdf sample 058780-02.pdf I get an exception in the ImageRenderInfo.GetImage() method the "PdfImageObject" is not returned and with a message saying "The color depth 1 is not supported". Any suggestions? Thanks, Abedellatif

like image 585
Abedellatif Hussein Avatar asked Oct 29 '22 19:10

Abedellatif Hussein


1 Answers

i fixed it, modify the iTextSharp source code PdfImageObject class FindColorspace method at 222 line add

if (PdfName.CALGRAY.Equals(tyca) || PdfName.DEVICEGRAY.Equals(tyca)) {
    stride = (width * bpc + 7) / 8;
    pngColorType = 0;
}
like image 65
Dudu Avatar answered Jan 02 '23 20:01

Dudu