# Suppressing output messages

**URL:** <https://forum.mupdf.com/t/suppressing-output-messages/349>\
**Category:** PyMuPDF\
**Created:** [May 15, 2026, 6:55am UTC](https://forum.mupdf.com/t/suppressing-output-messages/349 "2026-05-15T06:55:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wressl](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.mupdf.com/wressl/32/393_2.png) [@wressl](https://forum.mupdf.com/u/wressl)\
**Post date:** [May 15, 2026, 6:55am UTC](https://forum.mupdf.com/t/suppressing-output-messages/349/1 "2026-05-15T06:55:39Z")

</div>

When using .to\_markdown I get output messages to stdout which I cannot seem to suppress:

* * *

=== Document parser messages ===

Using Tesseract for OCR processing.

OCR on page.number=0/1.

* * *

I have tried many strategies with no luck… Is there some way to disable these messages??

# Suppress all PyMuPDF/Tesseract messages entirely

os.environ[“PYMUPDF\_MESSAGE”] = “”  
os.environ[“PYMUPDF\_MESSAGE”] = “path:pymupdf\_logs.txt”

# Disable logging for pymupdf/pymupdf4llm

logging.getLogger(“pymupdfllm”).setLevel(logging.CRITICAL + 1)  
logging.getLogger(“pymupdf”).setLevel(logging.CRITICAL + 1)  
logging.getLogger(“pypdf”).setLevel(logging.ERROR)  
logging.getLogger(“fitz”).setLevel(logging.CRITICAL + 1)  
logging.getLogger(“tesseract”).setLevel(logging.CRITICAL + 1)

# Suppress MuPDF errors

fitz.TOOLS.mupdf\_display\_errors(False)

# Suppress MuPDF error and warning messages

pymupdf.TOOLS.mupdf\_display\_errors(False)  
pymupdf.TOOLS.mupdf\_display\_warnings(False)

# Redirect stdout

with open(‘output.txt’, ‘w’) as f:  
sys.stdout = f # Change the standard output to the file we created  
print(“This message goes to the file”)

---

<div class="post-metadata">

**Author:** ![Jamie\_Lemon](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.mupdf.com/jamie_lemon/32/5_2.png) [@Jamie\_Lemon](https://forum.mupdf.com/u/Jamie_Lemon)\
**Post date:** [May 15, 2026, 1:00pm UTC](https://forum.mupdf.com/t/suppressing-output-messages/349/2 "2026-05-15T13:00:27Z")

</div>

@wressl Welcome to the forum!!! Have you tried this API: [https://pymupdf.readthedocs.io/en/latest/functions.html#set\_messages](https://pymupdf.readthedocs.io/en/latest/functions.html#set_messages)

Let me know how it works for you!

---

<div class="post-metadata">

**Author:** ![HaraldLieder](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.mupdf.com/haraldlieder/32/14_2.png) [@HaraldLieder](https://forum.mupdf.com/u/HaraldLieder)\
**Post date:** [May 15, 2026, 2:44pm UTC](https://forum.mupdf.com/t/suppressing-output-messages/349/3 "2026-05-15T14:44:35Z")

</div>

Underpinning @Jamie_Lemon 's comment:  
Here is an example session that stores away pymupdf4llm’s message output:

 ![image](https://canada1.discourse-cdn.com/flex004/uploads/mupdf/original/1X/674f66541194294c763d5f9631775f5083161b4c.png)

---

<div class="post-metadata">

**Author:** ![wressl](https://yyz2.discourse-cdn.com/flex004/user_avatar/forum.mupdf.com/wressl/32/393_2.png) [@wressl](https://forum.mupdf.com/u/wressl)\
**Post date:** [May 16, 2026, 4:14am UTC](https://forum.mupdf.com/t/suppressing-output-messages/349/4 "2026-05-16T04:14:16Z")

</div>

Thank you! The advice and example were very helpful and had the desired effect.
