Cookbook

Runnable recipes for PDF to Markdown, chunking, RAG and document processing with PyMuPDF. Open any recipe in Colab or download the notebook.

AICitationsPDFGrounding

Fuzzy Number Matching with the PyMuPDF Grounding Skill

Match numbers in AI quotes against their word equivalents in a PDF

Intermediate · 5 min read
AICitationsPDFGrounding

Chunked Documents with PyMuPDF

Chunk blocks of text with bounding boxes using PyMuPDF.

Intermediate · 4 min read
AICitationsPDFGrounding

Build an Evidence Pack for an AI Answer

Turn an AI answer and its citations into one PDF that a reviewer, an auditor or a customer can check without any other tools.

Intermediate · 9 min read
AICitationsPDFGroundingHallucinations

Catch Hallucinated Citations

Run every quote an AI answer cites through the source PDF, and count the ones that are not there.

Intermediate · 12 min read
AICitationsPDFGroundingTables

Cite the Table Cell, Not the Page

When an AI answer quotes a number from a financial table, point to the exact cell, with its row and column, instead of the whole page.

Intermediate · 6 min read
AICitationsPDFGroundingOCR

Know Which Evidence Came from OCR

Not all text in a PDF is equally reliable. Tell born-digital text from OCR text, and flag OCR evidence for review.

Intermediate · 8 min read
AICitationsPDFGroundingLLM

Verify AI-Extracted Values Against the PDF

An LLM pulls fields out of an invoice or contract. Before anyone relies on them, check each value against the document and show where it is printed.

Intermediate · 9 min read
AICitationsPDFGroundingRAG

Keep Page Coordinates with Your RAG Chunks

Every chunk in your vector store can remember exactly where it came from in the PDF. PyMuPDF already gives you the coordinates; this article shows how to keep them.

Intermediate · 6 min read
AICitationsPDFGrounding

Cite Claude Answers

Sends a PDF to Claude with citations enabled, locates each cited passage on the page with PyMuPDF, highlights it, and exports coordinates for a web viewer.

Intermediate · 3 min read
AICitationsPDFGrounding

Ask a PDF and Highlight the Evidence

Answer questions from a PDF with page citations, verify each quoted passage, and create a copy with the evidence highlighted using PyMuPDF.

Intermediate · 7 min read
EmailPDFPyMuPDF

Convert an email to a PDF

Turn an email into a PDF document using PyMuPDF.

Intermediate · 4 min read
MarkdownRAGChunking

Convert a PDF to Markdown for RAG

Turn a PDF into structured Markdown and token-sized chunks ready for embedding, using PyMuPDF locally with no GPU or API key.

Beginner · 2 min read
ClaudeCitationsPDF

PDF Highlighting with Citations

Use Claude to analyze a PDF and highlight the passages that support its answers.

External cookbook
PyMuPDF Logo

© 2026 Artifex Software Inc. All rights reserved.