Skip to content
mahmoud-bebarsPublic

About

Convert PDFs into clean, AI-ready Markdown | powered by Claude.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

pdf2ai

Convert PDFs into clean, AI-ready Markdown — powered by Claude.

Stop feeding raw PDFs to your AI. Pre-convert them into token-efficient Markdown and cut context overhead by up to 80%.


What It Does

pdf2ai takes any PDF file and converts it to clean Markdown (or plain text) using Claude's native PDF understanding. Unlike parser-based tools, Claude handles:

  • Multi-column layouts
  • Scanned PDFs (OCR built-in)
  • Tables preserved as Markdown tables
  • Footnotes, headers, footers stripped in AI-Optimized mode
  • Arabic and multilingual content

Why This Exists

Every time you drop a raw PDF into an AI workflow, you're paying a hidden tax:

  • PDF requires a skill/tool invocation to read
  • Binary structure costs extra tokens to process
  • Garbled text from bad parsers degrades output quality

pdf2ai eliminates that tax. Convert once, reuse the clean Markdown everywhere.


Features

  • Three output modes: Standard Markdown | AI-Optimized | Plain Text
  • Token compression display: See exactly how much context you're saving
  • Download + Copy: One-click .md file download or clipboard copy
  • BYOK: Bring your own Anthropic API key — no account, no signup
  • Zero retention: Files never leave your browser. API calls go directly to Anthropic.
  • Streaming output: Watch the conversion happen in real time

Stack

Layer Technology
Framework React 18 + Vite
Styling Tailwind CSS
Components shadcn/ui
Language TypeScript
AI Anthropic, OpenAI, Gemini, Mistral SDKs
State Zustand
Validation Zod
Deployment Cloudflare Pages

Getting Started

Prerequisites

Local Development

# Clone the repo
git clone https://github.com/mahmoud-bebars/pdf2ai
cd pdf2ai

# Install dependencies
npm install

# Start dev server
npm run dev

Open http://localhost:5173

Build for Production

npm run build

Output is in dist/. Deploy to Cloudflare Pages by connecting the GitHub repo or dragging the dist/ folder into the Cloudflare dashboard.


Usage

  1. Enter your Anthropic API key (stored locally in your browser only)
  2. Drop a PDF file into the upload area
  3. Select your output mode:
    • Standard Markdown — full structural conversion, keeps all content
    • AI-Optimized — strips page numbers, headers, footers; recommended for RAG/prompts
    • Plain Text — no Markdown syntax, maximum token compression
  4. Click Convert PDF
  5. Watch the output stream in
  6. Download the .md file or copy to clipboard
  7. See your token savings in the stats panel

Output Mode Details

Standard Markdown

Best for: documentation, reading, archiving

Converts all PDF structure to proper Markdown: headings, lists, tables, code blocks. Preserves the full document including page metadata.

AI-Optimized (Recommended)

Best for: RAG pipelines, LLM prompt context, agent knowledge bases

Strips decorative noise: page numbers, repeated headers/footers, section dividers. Merges content split across page breaks. Clean heading hierarchy. Typically achieves 60-80% token reduction vs raw PDF.

Plain Text

Best for: simple Q&A, summarization tasks, maximum compression

No Markdown syntax at all. Just the text content with logical paragraph breaks. Maximum token efficiency. Loses table structure.


Token Savings: Why It Matters

Scenario Raw PDF After pdf2ai
10-page report ~15,000 tokens ~3,500 tokens
50-page technical doc ~75,000 tokens ~18,000 tokens
Scanned form (unreadable) ~5,000 tokens (garbage) ~800 tokens (clean)

Estimates vary by PDF content density and output mode.


Privacy

  • Your PDF is read locally in your browser using the FileReader API
  • It is sent as base64 to the Anthropic API using your own API key
  • Nothing is stored on any server — not by this app
  • Your API key is stored only in localStorage in your own browser
  • You can clear it at any time using the clear button in the key input

Limitations (v1)

  • Maximum file size: 20MB
  • Single file at a time (batch in v1.1)
  • Best results on text-based PDFs; scanned PDFs depend on Claude's OCR quality
  • Very large documents (100+ pages) may hit API token limits

Roadmap

v1.1

  • Chunk view: split output by page/section for RAG ingestion
  • Batch processing: convert multiple PDFs in a queue
  • Export as plain .txt alongside .md

v2

  • Arabic/RTL PDF special handling
  • Custom prompt mode: write your own extraction instructions
  • Shareable conversion configs

Built By

Mahmoud Bebars — mahmoudbebars.dev

Bob (Mahmoud Bebars) — backend-focused full-stack developer, Alexandria, Egypt. Building tools for AI builders.


License

MIT

About

Convert PDFs into clean, AI-ready Markdown | powered by Claude.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages