2.6 KiB
pdf — reading PDFs
Best practices for read_pdf: what it can extract, what it can't, and how to tell the difference.
What it does
read_pdf extracts a PDF's plain text content, best-effort, and
returns it as one block of text — no tool call needed to set anything
up first. It works well on PDFs that have a real embedded text layer,
which is the overwhelming majority of PDFs produced by real software:
Word or LibreOffice's "Export/Save as PDF", a browser's "Print to
PDF", Pandoc, Pages, most invoicing/reporting tools, and so on.
There's no create_pdf or edit_pdf — this skill (and read_pdf)
is read-only, for extracting data out of a PDF someone uploaded, not
for producing one. If someone wants a new PDF-shaped deliverable,
build it as a .docx/.pptx/.xlsx with create_document /
create_presentation / create_spreadsheet instead and say plainly
that this deployment can't export straight to PDF yet.
What it can't do
- No OCR. A scanned PDF (a photographed or scanned document saved
as a PDF of page images, with no underlying text layer) has nothing
for
read_pdfto extract — it returns an error saying so rather than returning nothing silently or guessing at content. If that happens, say plainly that the PDF appears to be scanned/image-only and this tool can't OCR it. - No layout. Tables, multi-column text, headers/footers, and figure captions all come back as part of the same flat text stream, roughly in reading order but with no structural markers — a two-column PDF's columns may interleave line by line rather than reading column-by-column. Don't present extracted text as if it preserves a PDF's original formatting or table structure.
- Unusual font encodings (a PDF whose fonts remap character codes in a nonstandard way, with no usable mapping back to plain text) can come out as mangled or missing text for just that portion of the document, even when the rest extracts cleanly.
Using it well
- Read the whole PDF first before answering questions about it — the tool has no "just page 3" mode yet, it always returns everything it can extract in one call.
- If the extracted text looks suspiciously short relative to what the person describes the PDF as containing, say so rather than treating a short result as the complete document — it may be mostly scanned pages with only a cover page or two of real text.
- Don't infer a PDF's page count, visual layout, or anything about
images/charts in it from
read_pdf's output; it only ever reports what text it found, never a page-by-page breakdown.