Use case · Local-only AI
Client-side PDF Q&A
User drags a PDF, asks questions, gets answers — all in the browser. No upload. No server. No 700 MB Docker image for pdf-processing. Compliance and privacy teams love it.
@linda/parsers-pdfVFS /user/filesno backend
Try it live → Run the PDF Q&A demo — drop a PDF, ask questions, all in your browser.
The shape
You have a doc your team needs to chat with. You don’t want to build a RAG pipeline. You don’t want to upload PDFs to a vendor. You want the fastest path from “drop file” to “ask question.”
<script src="https://unpkg.com/@linda/script/dist/linda.js"></script>
<script type="module">
// Lazy-register the PDF parser on linda:ready (fires after auto-init).
window.addEventListener("linda:ready", async (e) => {
const linda = e.detail;
const { pdfTextParser } = await import("https://esm.sh/@linda/parsers-pdf");
linda.parsers.add(pdfTextParser);
});
</script>
<form
data-linda
data-linda-config="/configs/pdf-qna.json"
data-linda-provider="anthropic"
data-linda-key="sk-ant-..."
>
<input name="pdf" type="file" accept="application/pdf" />
<textarea name="question"></textarea>
</form>
That’s it. Drop a PDF, ask “what’s the indemnity cap?”, get a citation.
What’s happening
- PDF dropped onto the page →
onFileUploadhook fires. @linda/parsers-pdf(pdf.js) parses the file in-browser. Output lands in/user/files/<id>/parsed/text.mdandpages.jsonl.- User asks a question. The agent reads the parsed text and answers, quoting the source if relevant.
- The raw PDF stays in browser memory. Nothing uploaded.
Compliance angle
- GDPR: Linda doesn’t process personal data on a server. There’s no controller-processor relationship to model.
- HIPAA-friendly: If your provider has a BAA, you only need to worry about the prompts that hit it — the file itself is local.
- No vendor lock: Swap providers without re-uploading documents anywhere.
Cost
Per Q: ~5–10 K tokens of context (the parsed PDF chunks the model picks) +
500-token answer. **$0.02 per question** on Sonnet 4.6, with prompt caching
making follow-up Qs ~$0.002.
Runnable example: https://github.com/neul-labs/linda/tree/main/examples/pdf-qna
FAQ
How big a PDF can it handle?
Practically: ~100 pages. pdf.js parses page-by-page in workers; very large PDFs chunk into /user/files/<id>/parsed/pages.jsonl and the model reads pages it needs.
Does this work offline (Ollama)?
Yes — paired with the Ollama provider, the entire flow runs on the user's machine. No internet.
Ship an agent-driven flow this afternoon.
Install Linda, paste a config, and your form turns into an agent that fills its own inputs.