pdf editing
This skill provides the engineering patterns and validation logic required to build reliable PDF editing systems using Python and PyMuPDF.
$5
pdf editing
Example session with this skill installed
I need to redact a specific area on page 1 of 'invoice.pdf'. The coordinates are [100, 100, 240, 135]. Save it as 'redacted.pdf' and verify the text is gone.
- Read your context and instructions
- Compiled the pdf editing
- Generated the document
I have applied a secure redaction to the specified region on page 1 of invoice.pdf. The process included adding a redaction annotation, applying the removal, and saving the document with full garbage collection to ensure the data is not recoverable.
Redaction Report
| Page | Region (x0, y0, x1, y1) | Result | Text Verification |
|---|---|---|---|
| 1 | [100.0, 100.0, 240.0, 135.0] | Applied & Sanitized | 0 matches found in output |
import pymupdf
# Implementation used for this operation
doc = pymupdf.open("invoice.pdf")
page = doc[0]
region = pymupdf.Rect(100, 100, 240, 135)
# 1. Add redaction annotation
page.add_redact_annot(region, fill=(0, 0, 0))
# 2. Apply and remove content
page.apply_redactions(images=pymupdf.PDF_REDACT_IMAGE_NONE)
# 3. Save with garbage collection to remove cross-references
doc.save("redacted.pdf", garbage=4, deflate=True)
doc.close()
# 4. Post-save verification
check_doc = pymupdf.open("redacted.pdf")
extracted_text = check_doc[0].get_text("text", clip=region)
print(f"Post-redaction text count: {len(extracted_text.strip())}")
check_doc.close()
Next steps
- Open
redacted.pdfin a standard viewer to visually confirm the blacked-out region. - Run
test_redaction_security.pyto check for any residual metadata or shared image resources. - If this document contains OCR layers, consider running an additional pass to verify the hidden text layer was also removed.
invoice.pdf
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Working with PDFs usually means fighting broken layouts, lost text, and incomplete redactions that leave sensitive data extractable. This skill provides the engineering patterns and validation logic required to build reliable PDF editing systems using Python and PyMuPDF. It helps you manage complex coordinate transforms, typography, and secure document sanitization without common library pitfalls.
What it does
- Coordinate management translates between PDF user space, rotated display space, and browser canvas pixels.
- Content manipulation handles text insertion, replacement, and deletion with font alias mapping.
- Secure redaction implements multi-layer removal of text, images, and graphics beyond simple visual overlays.
- Page operations manages reordering, rotation, duplication, and merging with 1-indexed to 0-indexed conversion.
- Fidelity validation verifies rendering output and structural integrity post-save to prevent regression.
How it works
- Reconnaissance performs document inspection to identify rotation, page boxes, and selectable versus scanned content.
- Validation enforces schema constraints on operation payloads, including finite numeric geometry and page bounds.
- Execution applies ordered operations using PyMuPDF while preserving the source document as immutable.
- Sanitization applies redaction annotations followed by full garbage collection and rewrite.
- Verification reopens the output file to confirm structural and visual postconditions.
Frameworks & tools
Python, PyMuPDF (fitz), FastAPI, Next.js, and TypeScript. Includes a reference implementation based on the PaperForge workspace architecture.
Why this beats prompting it yourself
Generic AI prompts often ignore the difference between drawing a black box and actual content redaction, leading to data leaks. This skill enforces strict coordinate transformations and verification steps that generic code generation typically skips.
Use cases
- Building a web-based PDF editor with a React frontend and Python backend.
- Automating the redaction of PII from large document batches.
- Implementing digital signature overlays and form field updates.
- Developing regression test suites for document processing pipelines.
Known limitations
Does not support cryptographic digital signatures or certificate-based identity. Performance is limited by PyMuPDF and OCR engine overhead for large image-heavy documents.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 13 days ago
Permissions
What's inside
Frequently Asked Questions
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse All Claude Skills.