// api reference
Extract the plain-text content from any PDF. Ideal for indexing, full-text search, parsing, or feeding documents into an LLM.
Every PDF tool runs as a small CustomJS function using our built-in pdfUtils. Write a few lines of JavaScript, deploy once, and you get a private API endpoint you can call from anywhere. Make.com, n8n, or plain curl.
Paste the function below into the editor at app.customjs.space.
Set the Response Type to Text and deploy.
Call your function URL with the x-api-key header.
Import PDFTOTEXT from ./utils and return its result. Remember to set the function's Response Type · Text
const { PDFTOTEXT } = require('./utils');
const pdfInput = input.file || input.url;
return PDFTOTEXT(pdfInput);POST to your function URL. Pass the source PDF either as a public URL or a Base64 string. The request payload is capped at 6Â MB.
| Field | Type | Description |
|---|---|---|
| url | string | Public URL of the source PDF. Provide either url or file. |
| file | string | Base64-encoded PDF binary (payload max 6 MB). |
curl -X POST https://e.customjs.io/<your-function-id> \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"url": "https://css4.pub/2017/newsletter/drylab.pdf"
}' --output document.txtcurl -X POST https://e.customjs.io/<your-function-id> \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"file": "JVBERi0x..........EyNzg3CiUlRU9GCg=="
}' --output document.txt// try it first
Open the interactive playground on the product page. Generate PDFs live, tweak the code, and copy the generated curl or SDK snippet straight into your stack.
curl -X POST https://e.customjs.io/<your-function-id> \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"url": "https://css4.pub/2017/newsletter/drylab.pdf"
}' --output document.txt600 free operations / month · no credit card