Extracting PDFs in the Browser
Key point
Ran LiteParse in the browser to build a PDF text extraction web app that even supports OCR.
Details
LlamaIndex's open-source LiteParse was originally a Node.js CLI tool for extracting PDF text, but it was ported to a browser-only version using the same underlying PDF.js and Tesseract.js. The core isn't an AI model but spatial text parsing that reads PDF layout, with OCR optionally attached for image-based PDFs.
To improve document trustworthiness, it also handles visual citations with bounding boxes. By cropping and highlighting the regions that back up an answer as images, it becomes much easier to verify sources in RAG-style Q&A.
In the web demo, you can:
- Drop or select a PDF for immediate extraction
- Toggle OCR on and off
- View per-page screenshots
- Copy the extracted Text and nicely formatted JSON separately
The implementation was done with Claude Code and Opus 4.7. First, notes.md and plan.md were created, then a plan including Playwright and red/green TDD was drawn up, followed by a series of small commits. Details like the dropzone UI, showing Copied! after copying, Safari compatibility issues, and disabling OCR by default were repeatedly refined, and finally testing via GitHub Actions and deployment to GitHub Pages were automated.
Final verification was done by having OpenAI Codex's GPT-5.5 explain the differences between the Node.js CLI and the web version, to confirm no core functionality was missing. The build it phase took about 59 minutes, and since there had been no discussion with the LiteParse team yet, an issue was left instead of a PR. Since all processing finishes inside the browser with no additional network requests, this project is summarized as a relatively safe example of vibe coding.