PDF to Text & Image

FREEMIUM
By Himas Rafeek | Updated 1ใƒถๆœˆๅ‰ | Tools
Popularity

6.4 / 10

Latency

1,045ms

Service Level

100%

Health Check

N/A

README

PDF Processing API

Welcome to the PDF Processing API! Convert PDF documents to text or images with ease using our simple API endpoints.

Features

  • PDF to Text: Extract plain text from PDF documents.
  • PDF to Image: Convert each page of a PDF document into individual images.

Getting Started

To get started, make a POST request to the endpoints listed below. All requests must be sent with a Content-Type of application/json.

Endpoints

Maximum File size is - 50MB

PDF to Text

  • Path: /pdf-to-text
  • Method: POST
  • Body Parameters:
    • pdfBase64: A string containing the base64-encoded PDF content.

PDF to Image

  • Path: /pdf-to-image
  • Method: POST
  • Body Parameters:
    • pdfBase64: A string containing the base64-encoded PDF content.

Responses

Responses will be returned in JSON format. A successful response for the PDF to text endpoint will contain the extracted text. For the PDF to image endpoint, a link to download a zip file containing the images will be provided.

Sample Code & Success Response for PDF to Text

const fs = require('fs');
const axios = require('axios');
const pdf = fs.readFileSync('sample.pdf', {
  encoding: 'base64'
});

// Your API endpoint
const apiEndpoint = '...enpoint/pdf-to-text';

// Set up the axios POST request
axios.post(apiEndpoint, {
    pdfBase64: pdf
  })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });

Repsonse

{
  "text": "Extracted text content...",
  "formatedText": "Formatted extracted text content..."
}

Sample Code & Success Response for PDF to Image

const fs = require('fs');
const axios = require('axios');
const pdf = fs.readFileSync('sample.pdf', {
  encoding: 'base64'
});

// Your API endpoint
const apiEndpoint = '...enpoint/pdf-to-image';

// Set up the axios POST request
axios.post(apiEndpoint, {
    pdfBase64: pdf
  })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });

Response

{
  "link": "..../temp/pdf-images-uniqueID.zip"
}

Generated PDF file will be deleted after 1 Hour of creation.

Error Handling

If thereโ€™s an error with your request, the API will return an error status code and a JSON object with an error key describing the issue.

Sample Error Response

{
  "error": "Description of the error."
}

Rate Limits

Please note that there are rate limits in place to ensure fair usage. Contact support for more details on the limits and how to accommodate higher usage.

Followers: 0
API Creator:
Rapid account: Himas Rafeek
Himas Rafeek
himasme99
Log In to Rate API
Rating: 5 - Votes: 1