How to Search a PDF From Your Editor
Every integration has one: the partner spec, the compliance manual, the vendor's 80-page PDF that governs what your code must do. Your questions about it arrive mid-function — and the answer ritual is alt-tab, scroll, squint, Ctrl+F, lose your place twice.
With Apdf connected to Claude Code or Cursor over MCP, the spec becomes something you ask from the editor — and the answers come back with the exact line and page number, ready to paste into a code comment.
Connect your editor to Apdf
In Claude Code it's one command; Cursor and other MCP clients take the same endpoint in their MCP settings:
claude mcp add --transport http apdf https://apdf.io/mcp/main
The spec just needs a reachable URL — your team drive, object storage, or a private Apdf document.
Ask mid-function
https://files.northlight.example/specs/paylane-spec.pdf
Under the answer, search-pdf-content returned the
receipts — the exact line, with its page:
{
"search_text": "backoff",
"results_total": 1,
"results_pages": 1,
"results": [
{
"page": "3",
"matched_line": "Retries: 5 attempts with exponential backoff starting at 30 seconds.",
"exact_word": "backoff"
}
]
}
Go regex when the question is a pattern
The search accepts regular expressions — which turns “list every error code the spec defines” into one call:
{
"search_text": "ERR-\\d+",
"results_total": 3,
"results_pages": 1,
"results": [
{
"page": "4",
"matched_line": "Errors use stable codes: ERR-1401 expired token, ERR-2201 duplicate idempotency key,",
"exact_word": "ERR-1401"
},
{
"page": "4",
"matched_line": "Errors use stable codes: ERR-1401 expired token, ERR-2201 duplicate idempotency key,",
"exact_word": "ERR-2201"
},
{
"page": "4",
"matched_line": "ERR-3305 payout account frozen. Codes never change meaning between versions.",
"exact_word": "ERR-3305"
}
]
}
read-pdf-content returns whole
pages for context, and for scanned specs the
search-pdf-content-with-ocr variant runs an OCR pass first —
the OCR tutorial
covers it.
Where to go from here
The same connection carries every PDF operation — and the engagement layer behind them.
Related tutorials
Building a "Search Inside PDF" Feature for Your Web App
This tutorial shows how to build a PDF search feature using Python and the Apdf Search API. Find specific terms, get page numbers and context lines, and optionally use regex patterns for advanced matching. Includes a Flask web interface example.
Watermark Draft PDFs via Claude Before Sharing
The draft that leaks is the one you didn't stamp. Conversationally it's one message: the agent designs the translucent DRAFT — CONFIDENTIAL stamp itself with the PDF generator, overlays it across every page, renders a page to prove it looks right — and mints one named copy per reviewer.
Password-Protect PDFs in an Agent Workflow
Encryption as a step the agent runs, not a desktop-tool detour: lock a client statement with owner and user passwords, have the agent probe the result to prove the lock held (encrypted: true, everything else hidden), and unlock the archive copy in the same conversation.
Your code made the PDF.
Then it went dark.
Opened, read, re-read, dropped on page 4 — you never see any of it. Share the PDFs you generate through Apdf recipient links, and every signal becomes something you can act on: ping Slack, update the CRM, let an agent follow up. Same account, same API token, one more call.
API · Webhook · MCP