2019.04.02 09:54 "[Tiff] TIFFWriteEncodedStrip is resulting in error.", by Ganesh Bondili

2019.04.02 09:54 "[Tiff] TIFFWriteEncodedStrip is resulting in error.", by Ganesh Bondili


We have a Customer that has reported that they are unable to convert attached(below link) PDF file(5C826DA7.pdf) from PDF to Tiff and resulting in error. We are using first Datalogics library to load & draw each page from PDF file to memory buffer which we then use LibTIFF library to write to TIFF file as below with given Tags set. In case of resolution 'TIFFTAG_XRESOLUTION' set as 300x300, error is generated at 'TIFFWriteEncodedStrip()' function with below values. Buffer looks good when saved as BMP file. Same file gets converted successfully for 200x200 resolution.


What is the reason for error for this PDF file at 'TIFFWriteEncodedStrip()' function and can this be resolved and converted to TIFF without error at 300x300 resolution.

                                TIFFSetField(hTIFF, TIFFTAG_IMAGEWIDTH, 24209);
                                TIFFSetField(hTIFF, TIFFTAG_IMAGELENGTH, 22730);
                                TIFFSetField(hTIFF, TIFFTAG_COMPRESSION, 7);
                                TIFFSetField(hTIFF, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
                                TIFFSetField(hTIFF, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
                                TIFFSetField(hTIFF, TIFFTAG_XRESOLUTION, 300); // works good for 200
                                TIFFSetField(hTIFF, TIFFTAG_YRESOLUTION, 300); // works good for 200
                                TIFFSetField(hTIFF, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
                                TIFFSetField(hTIFF, TIFFTAG_SOFTWARE, "Conv ");
                                TIFFSetField(hTIFF, TIFFTAG_SAMPLESPERPIXEL, 3);
                                TIFFSetField(hTIFF, TIFFTAG_BITSPERSAMPLE, 8);
                                TIFFSetField(hTIFF, TIFFTAG_PHOTOMETRIC, 2);
                                TIFFSetField(hTIFF, TIFFTAG_JPEGQUALITY, 75);

                                Ret1 = TIFFWriteEncodedStrip(hTIFF, 0, buffer, 1650811710);// Error occurs here - returns '-1' value
                                if (Ret1 != -1) {
                                                Ret2 = TIFFWriteDirectory(hTIFF);

Ganesh Bondili
Senior Software Engineer
Kofax India Private Limited

The V, Capella Block 6th Floor, Plot No17, Software Units Layout, Madhapur
Hyderabad, 500081

Tel: +91 40 45459949
Fax: +91 40 45459922


Register for the Free Trial of Kofax RPA<https://www.kofax.com/Products/Robotic-Process-Automation/Kapow/rpa-free-trial>

blog<http://www.kofax.com/blog/> | twitter<https://twitter.com/Kofax> | linkedin<https://www.linkedin.com/company/kofax> | facebook<https://www.facebook.com/kofax.inc>


This communication is only for the use of the intended recipient. It may contain confidential or proprietary information. If you are not the intended recipient or have received this communication in error, please notify the sender via phone and destroy this communication immediately.