What causes "insufficient image data" in pdf

I have a Python program (using pyPDF) that integrates a bunch of different PDF documents. Sometimes the resulting pdf file is good, with the exception of some blank pages in the middle. When I view these documents using Acrobat Reader, I get an "Insufficient image data" error message. When I view documents using FoxIT Reader, I get several blank pages and a painful image.

The only caveat in a PDF document that creates blank pages is that it looks like PDF version 1.4, and PyPdf seems to create files with PDF version 1.3.

1) Does the version sound like the main cause of my problem?

2) Is there a way to get PyPdf to handle this correctly?

+3
source share
3 answers

This may be due to Windows and not to the .pdf file.

http://support.microsoft.com/kb/2506795

Good luck

+2
source

I had this problem and was able to deal with it by looking at the original pdf along with PyPDF in a hex editor.

The problem is that PyPDF actually leaves a byte - it looks like probably the first byte in each image stream is missing. When I added bytes to the PyPDF file, the PDF file was opened without errors.

+2
source

, XObject Malformed. PDF , , .

, pdf- , 10 , 10 8 , 100 . , , , .

, pypdf , .

IIRC, PDF PDF, , . , .

This may be a bad color space. If you have an indexed color image (gif) and they translate it halfway to the RGB image but use the original indexed color bytes, you will get a stream that can expect n * 3 bits per pixel, but only have n bits per pixel .

Perhaps this is an older bug fixed in pypdf. Are you using the current version?

+1
source

Source: https://habr.com/ru/post/1767927/


All Articles