Skip to content

PDF

Official Anthropic skill that gives Claude a working PDF toolkit — extract text and tables, merge, split, rotate, watermark, OCR, encrypt, and fill forms.

What it does

Loads a working knowledge of the main Python PDF libraries (pypdf, pdfplumber, reportlab, pytesseract) and command-line tools (qpdf, pdftotext, pdfimages) so Claude picks the right one for each job instead of reinventing it. It handles reading, extraction, assembly, rotation, watermarking, encryption, OCR of scanned documents, and PDF creation, plus a dedicated form-filling flow via a linked FORMS.md guide. Reach for it any time a task mentions a .pdf file or asks Claude to produce one.

Use cases

  • Extract tables from a stack of invoices or reports into a single Excel or CSV file using pdfplumber and pandas, without hand-copying rows.
  • Merge, split, or rotate PDFs in a scripted batch — for example, splitting a 300-page scanned book into per-chapter files or rotating pages that were scanned sideways.
  • OCR a scanned contract or receipt by converting pages to images with pdf2image and running pytesseract, so the resulting text is searchable and quotable.

When to use it

  • The user mentions a .pdf file as input or output.
  • You need structured data (tables, form fields, metadata) out of a PDF, not just a screenshot.
  • The task requires assembling or modifying PDFs — merge, split, watermark, encrypt, rotate.
  • The source PDF is a scan and text extraction is returning empty strings.

When NOT to use it

  • The document is already available as HTML, Markdown, or a Word file — parse the source format directly instead of round-tripping through PDF.
  • You need pixel-perfect visual editing of an existing PDF layout; use a design tool like Illustrator or Affinity Publisher.
  • The job is bulk conversion of thousands of PDFs on a schedule — build a dedicated pipeline rather than invoking Claude per file.
  • You need legally-binding digital signatures; use a signing service (DocuSign, Adobe Sign) rather than reportlab output.

Installation

Install in Claude Code

/plugin install pdf@anthropic-agent-skills

If you haven’t added the Anthropic marketplace yet, run this first:

Add Marketplace

/plugin marketplace add anthropics/skills

After install, just mention it in conversation:

Prompt

Take these three invoice PDFs, extract the line-item tables into a single Excel sheet, then merge the source PDFs into one file called 2026-Q1-invoices.pdf.

Troubleshooting

extract_text() returns an empty string or garbled characters. The PDF is almost certainly a scan (an image wrapped in a PDF container) rather than a text PDF. Switch to the OCR path: convert each page to an image with pdf2image.convert_from_path(), then run pytesseract.image_to_string() on each image. Install poppler-utils and Tesseract at the system level first.

Subscripts and superscripts render as black boxes in a reportlab PDF. Do not paste Unicode subscript or superscript characters (₂, ²) — the built-in reportlab fonts do not include those glyphs. Use Paragraph objects with the XML tags <sub> and <super> instead, for example Paragraph("H<sub>2</sub>O", styles['Normal']). For canvas-drawn text, adjust font size and Y-position manually.

pdfplumber extracts a table but the rows and columns are misaligned. Default table detection relies on rulings; on borderless tables it guesses from whitespace and often misreads. Tune extract_tables() by passing a table_settings dict with vertical_strategy and horizontal_strategy set to "text", and inspect page.debug_tablefinder().tables visually before trusting the output.

qpdf or pypdf refuses to open an encrypted PDF. Supply the password explicitly. With qpdf: qpdf --password=mypassword --decrypt encrypted.pdf decrypted.pdf. With pypdf: call reader.decrypt("mypassword") immediately after PdfReader(...). If the file uses AES-256 and your pypdf is older than 3.9, upgrade — earlier versions silently fail on modern encryption.