BUG: pymupdf.mupdf.FzErrorArgument: code=4: Invalid bandwriter header dimensions/setup

While processing a set of PDFs we are receiving the following error

pymupdf.mupdf.FzErrorArgument: code=4: Invalid bandwriter header dimensions/setup

please let me know if you have any questions. The documents are of a confidential nature so I can’t post them here :frowning:

Versions of the software are:
Python 3.11.13

PyMuPDF~=1.26.6

pymupdf-layout~=1.26.6

pymupdf4llm~=0.2.5

This looks like a low level MuPDF error. Let me see if I can find out more …

Talking to a MuPDF engineer they tell me:

  1. seems like this is printed for negative width/height or out of range alpha values.

  2. so we know that they are writing a document to some kind of output format, but they are not telling us which one.

  3. my best bet is that somewhere a page has been rendered to a pixmap and this has width == 0 or height == 0.

  4. because in fz_new_pixmap_with_data() we check:

     if (w < 0 || h < 0) fz_throw(ctx, FZ_ERROR_ARGUMENT, "Illegal dimensions for pixmap %d %d", w, h); 
  5. but why did the pixmap end up with dimensions at zero? no idea. they need to tells us what they are doing.

  6. While processing a set of PDFs” is not clear enough.


So maybe you can give me some more information and check the Page as Pixmap thing?

I believe the latest update to PyMUPDF4LLMs 0.2.6 fixed the issue. :slight_smile:

1 Like