Description
Traceback
src/document.py:173: in save
mupdf_page.apply_redactions(
/usr/lib/python3.14/site-packages/pymupdf/__init__.py:10770: in apply_redactions
rc = page._apply_redactions(text, images, graphics) # call MuPDF
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/pymupdf/__init__.py:9929: in _apply_redactions
success = mupdf.pdf_redact_page(page.doc(), page, opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
doc = <mupdf.PdfDocument; proxy of <Swig Object of type 'mupdf::PdfDocument *' at 0x7fea1fe92b70> >
page = <mupdf.PdfPage; proxy of <Swig Object of type 'mupdf::PdfPage *' at 0x7fea1fdc16b0> >, opts = (black_boxes=0 image_method=2 line_art=2 text=0)
def pdf_redact_page(doc, page, opts):
r"""Class-aware wrapper for `::pdf_redact_page()`."""
> return _mupdf.pdf_redact_page(doc, page, opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E mupdf.FzErrorArgument: code=4: only Gray, RGB, and CMYK colorspaces supported
Examples for failing documents
How to reproduce with PyMuPDF
document = pymupdf.Document("tests/data/samples_artifex/foo0-ge-64k.pdf")
page = document[0]
page.add_redact_annot((140, 0, 150, 1))
page.apply_redactions()
Upstream issues
## Description
### Traceback
```py
src/document.py:173: in save
mupdf_page.apply_redactions(
/usr/lib/python3.14/site-packages/pymupdf/__init__.py:10770: in apply_redactions
rc = page._apply_redactions(text, images, graphics) # call MuPDF
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/pymupdf/__init__.py:9929: in _apply_redactions
success = mupdf.pdf_redact_page(page.doc(), page, opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
doc = <mupdf.PdfDocument; proxy of <Swig Object of type 'mupdf::PdfDocument *' at 0x7fea1fe92b70> >
page = <mupdf.PdfPage; proxy of <Swig Object of type 'mupdf::PdfPage *' at 0x7fea1fdc16b0> >, opts = (black_boxes=0 image_method=2 line_art=2 text=0)
def pdf_redact_page(doc, page, opts):
r"""Class-aware wrapper for `::pdf_redact_page()`."""
> return _mupdf.pdf_redact_page(doc, page, opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E mupdf.FzErrorArgument: code=4: only Gray, RGB, and CMYK colorspaces supported
```
### Examples for failing documents
- [samples_artifex/foo0-ge-64k.pdf](https://github.com/ArtifexSoftware/tests/blob/master/pdf/foo0-ge-64k.pdf)
### How to reproduce with PyMuPDF
```py
document = pymupdf.Document("tests/data/samples_artifex/foo0-ge-64k.pdf")
page = document[0]
page.add_redact_annot((140, 0, 150, 1))
page.apply_redactions()
```
## Upstream issues
https://github.com/pymupdf/PyMuPDF/issues/4943