Integration-PDF API – Fast and Affordable Document Generation-pdf-to-text

PDF to Text

Extract plain text content from your PDF documents – ideal for indexing, searching, or further processing.


CustomJS Code

const { PDFTOTEXT } = require('./utils'); 

const pdfInput = input.file || input.url;

return PDFTOTEXT(pdfInput, input.pageRange);

Reponse Type

Make sure that the response type is set to text.

Execution via API request

Option 1: Passing the PDF as a URL

This example shows how to extract text from a PDF using a provided URL.

curl -X POST https://e.customjs.io/zeXXXy \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY_HERE" \
  -d '{
    "url": "https://css4.pub/2017/newsletter/drylab.pdf"
  }' --output test-by-url.txt

Option 2: Passing the PDF as a base64 encoded string

This example shows how to extract text from a PDF by sending a Base64-encoded binary string. Keep in mind that the payload size is limited to 6 MB.

curl -X POST https://e.customjs.io/zeXXXy \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY_HERE" \
  -d '{
    "file": "JVBERi0x..........EyNzg3CiUlRU9GCg=="
  }' --output test-by-string.txt