API

Document conversion and OCR API

Turn Word, HTML and text files into PDF. Pull text out of PDFs and scanned images with OCR (text reading).

Problems we solve

Does any of this sound like your week?

Installing LibreOffice on a server is a pain.

Upload a Word, HTML or text file to the PDF endpoint and get a PDF back. You run no engines yourself.

Our scanned invoices cannot be searched.

Post the PDF to the to-text endpoint. Pages with no text go to OCR automatically, and you get the text for each page.

Photos of error screens are useless in tickets.

Post the image to the to-text endpoint. You get the text back, ready to drop into the ticket.

My HTML report needs its logo and styles in the PDF.

Send the images, styles and fonts as attachments, or one .zip. You get a clean PDF back.

What it does

  • The Document Conversion and OCR API does two jobs. Every business app needs them sooner or later. It makes PDFs from the files people already have. It also reads text out of PDFs and pictures.
  • It solves the "install LibreOffice on a server and hope" problem. Office converters, HTML renderers and OCR engines are heavy. They are fiddly to patch and easy to get wrong. Here they sit behind two endpoints. You upload a file and get a result back. You run no engines yourself.
  • To make a PDF, post a Word file (.docx, .doc, .docm, .dotx). You can also post an OpenDocument text (.odt), an .rtf or an HTML page. Plain text types work too (.txt, .md, .log, .csv, .tsv). HTML pages can bring their images, styles and fonts along. Send them as extra attachments. Or send one .zip bundle with an entry document. Remote asset links are blocked by default. This stops a document from making your server fetch internal addresses. You can opt in for documents you trust.
  • To read text, post a PDF or an image. For PDFs, the built-in text is read first. Pages with no usable text (scans) go to OCR automatically. Images in common formats, including multi-page TIFFs, go straight to OCR. You choose the OCR mode: auto, force or never. You pick one or more languages, such as eng or eng+spa. You can add a page range like 1-3,7.
  • The text result has the full text and the text for each page. It also shows the engine used, the page count and whether OCR ran. The PDF result is the raw PDF stream. Or it is a JSON body with the file as base64.
  • A capabilities endpoint tells you which engines are installed here. It also tells you the largest upload allowed. A missing engine returns 503. A file type we do not support returns 415. So you can tell a setup problem from a bad input.
  • Authenticate with an X-API-Key header or a Bearer token from Takelan SSO. Over the limit you get a 429 with a Retry-After header. We do not publish conversion times or OCR accuracy figures. They depend on the file.
  • Pricing that stays affordable. Start free*. *Free test level; past the limits, non-critical calls slow or pause and nothing is charged unless you turn overage on. Connected ShadowCradle organizations can switch on Takelan SSO and these base-included services with one switch. Airgap licences work without any Takelan connection.

See how it works

A document in, a PDF or text out

Two endpoints cover both jobs. Office, HTML and text files become PDFs; PDFs and images become text, with OCR used only where a page has no usable text.
Example use cases6 examples

Quotes and letters as PDF

A small business keeps its quote template as a Word file. The app fills it in and posts it to the converter. Then it emails the PDF to the customer.

Branded reports from HTML

A developer builds an HTML report with its own logo and stylesheet. They zip it with its images. They get back a clean PDF for the client portal.

Make scanned paperwork searchable

An office scans paper invoices to PDF. The to-text endpoint reads them with OCR. Your app can then index and search the text.

Read a photo of an error screen

A support tool lets a customer upload a photo of an error screen. The app extracts the text from the image and drops it into the ticket.

Multi-language archives

An IT team handles English and Spanish documents. It sets the language to eng+spa. It limits OCR to the pages it needs.

Feed documents to search or AI

A developer turns uploads into plain text first. Then they add the text to the knowledge store for the account. The assistant can answer from it.

Try it

Convert a Word file to PDF

curl -X POST https://app.takelan.com/api/v1/documents/to-pdf \
  -H "X-API-Key: $TAKELAN_API_KEY" \
  -F "file=@quote.docx" \
  -o quote.pdf

Add ?response_format=json to get the PDF as base64 inside JSON, not a raw stream.

Extract text from a scan

curl -X POST https://app.takelan.com/api/v1/documents/to-text \
  -H "X-API-Key: $TAKELAN_API_KEY" \
  -F "file=@invoice-scan.pdf" \
  -F "ocr=auto" \
  -F "language=eng" \
  -F "page_range=1-2"

# Response (abridged, fictional)
# {
#   "success": true,
#   "source_filename": "invoice-scan.pdf",
#   "source_kind": "pdf",
#   "ocr_used": true,
#   "language": "eng",
#   "page_count": 2,
#   "text": "INVOICE 1042 ...",
#   "pages": [ { "page": 1, "text": "INVOICE 1042 ..." } ]
# }
Endpoints3 endpoints
  • GET /api/v1/documents/capabilities Which engines are installed, accepted file types and the upload size cap.
  • POST /api/v1/documents/to-pdf Convert Office, HTML, text or a .zip bundle to PDF. Options: attachments, entrypoint, allow_remote_assets, response_format=pdf|json.
  • POST /api/v1/documents/to-text Extract text from a PDF or image. Options: ocr=auto|force|never, language, page_range.

MCP

Available as tools through /mcp/utils; writes off by default. The capabilities route can be read with a read-only key. Both conversion calls are POST requests, so they count as writes. They stay off until your account turns on the writes switch and uses a key that is not read-only. File uploads are multipart, so batch conversion is usually simpler over plain REST. Check tools/list for what your agent actually sees. About MCP

Common questions

how to convert docx to pdf with an api

POST the file to /api/v1/documents/to-pdf as multipart form data. Use your X-API-Key. You get back a PDF stream, or base64 JSON if you add response_format=json.

can I convert html with images and css to pdf

Yes. Upload the HTML as the file. Send its images, styles and fonts as attachments. Or upload one .zip with an entry document. Remote asset URLs are blocked unless you set allow_remote_assets.

how to extract text from a scanned pdf with ocr api

POST the PDF to /api/v1/documents/to-text. In the default auto mode, pages that already have text are read directly. Scanned pages go through OCR. Use ocr=force if the text layer is garbled.

which image formats does the OCR support

PNG, JPG, GIF, BMP, TIFF (multi-frame), WebP, HEIC/HEIF and JPEG 2000. Other formats the image library can read work too. Multi-frame files return one entry per frame.

does it support OCR in other languages

Yes. Pass Tesseract language codes in the language field, such as spa or eng+spa. Which language packs are present depends on the environment, and capabilities shows the engines.

is it safe to convert untrusted html to pdf

Remote asset fetching is off by default. This guards against server-side request forgery. Leave it off for documents you do not control.

what is the maximum document size

It is a deployment setting. GET /api/v1/documents/capabilities returns max_file_size_mb for your environment. A file over the cap is rejected.

is the document conversion api free

It is negotiable on price: start free*. *Free test level; past the limits, non-critical calls slow or pause and nothing is charged unless you turn overage on.

Analytics & Cookies

We use self-hosted Matomo analytics. By default we measure anonymously with no cookies. Enable cookies to help us improve your experience. You can change this anytime.