Logo
Apdf tutorials September 2026 3 min read

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.

What you'll build
A partner-API spec answering questions mid-implementation — this conversation, working end to end: “what's the retry policy?” → “5 attempts, exponential backoff from 30s — page 3”
MCP access needs Pro (14-day trial, no card)
1

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.

2

Ask mid-function

You
I'm writing the webhook consumer — what does the PayLane spec say about retries and timeouts?
https://files.northlight.example/specs/paylane-spec.pdf
Claude
apdf · search-pdf-content
Page 3: deliveries time out after 10 seconds, and they retry 5 times with exponential backoff starting at 30 seconds — so your consumer must answer fast and be idempotent across six possible deliveries. Each one is signed with the X-PayLane-Signature header (HMAC-SHA256).

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"
        }
    ]
}
3

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:

You
Pull every error code from the spec so I can build the exception map.
Claude
apdf · search-pdf-content (regex)
Three codes, all on page 4: ERR-1401 (expired token), ERR-2201 (duplicate idempotency key), ERR-3305 (payout account frozen) — and the spec promises codes never change meaning between versions.
{
    "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"
        }
    ]
}
Tip: Need more than the matched line? 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.

After the API call

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.

Your PDF, after sending Live
document:loaded CFO
page:read p4 · 38s
link:clicked pricing

API · Webhook · MCP