Most RAG tutorials skip the boring part: getting clean text out of PDFs on a server with no native dependencies. DocKit does it over HTTP. You pass a URL or upload the file, and you get the text back, page by page.
From a URL
import requests
H = {"X-RapidAPI-Key": KEY, "X-RapidAPI-Host": "dockit-pdf-text-extraction-markdown-to-pdf.p.rapidapi.com"}
r = requests.get("https://dockit-pdf-text-extraction-markdown-to-pdf.p.rapidapi.com/pdf/text",
params={"url": "https://example.com/report.pdf"}, headers=H)
data = r.json()
chunks = data["page_texts"] # one string per page, ready for chunking + embeddings
print(data["pages"], data["words"])
Upload a file
requests.post(".../pdf/text", headers=H, files={"file": open("invoice.pdf", "rb")})
The other direction: Markdown → PDF
pdf = requests.post(".../markdown-to-pdf", headers=H,
json={"text": "# Invoice\n\n**Total:** £120", "title": "Invoice"}).content
open("invoice.pdf", "wb").write(pdf)
Handy for invoices, reports and exporting LLM output. Add ?format=base64 to get JSON instead of bytes.
Limits: 10 MB per PDF, 200 pages. Free tier: 100 calls/month. DocKit on RapidAPI
Top comments (0)