Make Codex read PDFs

If your available tools can read the PDF directly and that answers the task, start there. Use conversion for scanned pages, OCR or Markdown you can reuse.

Requires Node 18+ and network access in your session. No account is needed for the demo.

Demo: page 1 only. Conversion sends your document to an external service. Follow your document-processing permissions.

terminal
$ npx pdftomarkdown@0.1.6 document.pdf

Compare the source PDF and complete Markdown output

Allow up to 11 minutes. Stopping the client may leave processing and charging running. CLI setup and recovery

Convert a full document

A new account gets 20 trial pages once, with full multi-page output and no watermark. Further pages use paid credits. Get an API key with GitHub, then set it in your environment.

Get an API key with GitHub →

shell profile
export PDFTOMARKDOWN_API_KEY=your_key_here

The CLI picks the key up automatically from the environment.

Optional: teach Codex this workflow with AGENTS.md

Add these instructions to your project’s AGENTS.md or ~/.codex/AGENTS.md. Available tools and processing permissions still apply.

AGENTS.md
## Reading PDFs

Native PDF support depends on the tools available in this session.
Use conversion when OCR or reusable Markdown helps the task. Documents
are sent to an external service; follow the user's processing permissions.
Use the published CLI with Node 18+:

    npx pdftomarkdown@0.1.6 document.pdf

Read successful output in sections for long documents. The demo converts
page 1 only. A new account gets 20 trial pages once; further pages use paid
credits. Never purchase credits without explicit user authorization.
Allow up to 11 minutes to wait; stopping the client may leave processing
and charging running. Follow https://pdftomarkdown.dev/docs/cli/ for version-specific recovery.