The pdfRest OCR PDF API Tool is a powerful resource for converting scanned documents and images into searchable and extractable text in PDF files. This tutorial will show you how to send an API call to OCR PDF with cURL, a command-line tool for transferring data using various network protocols.
Imagine you have a large number of scanned documents that you need to make searchable for easy retrieval. Using the OCR PDF API, you can automate this process, making it efficient and less prone to errors compared to manual data entry. This can be particularly useful for businesses dealing with large volumes of paperwork, such as legal firms or medical offices.
curl -X POST "https://api.pdfrest.com/pdf-with-ocr-text" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ -F "file=@/path/to/file" \ -F "output=example_out"
Source: GitHub
Let's break down the provided cURL command to understand how it works:
curl -X POST "https://api.pdfrest.com/pdf-with-ocr-text"
This line initiates a POST request to the endpoint https://api.pdfrest.com/pdf-with-ocr-text, which is the URL for the pdfRest OCR PDF API.
-H "Accept: application/json"
This header tells the server that the client expects the response to be in JSON format.
-H "Content-Type: multipart/form-data"
This header specifies that the content type of the request is multipart/form-data, which is necessary for file uploads.
-H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
This header includes the API key, which is required for authentication. Replace xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
with your actual API key.
-F "file=@/path/to/file"
This line specifies the file to be uploaded. Replace /path/to/file
with the actual path to the file you want to upload.
-F "output=example_out"
This line specifies the output file name. In this case, the output will be named example_out
.
In this tutorial, you learned how to make an API call to the pdfRest OCR PDF endpoint using cURL. This allows you to convert scanned documents into searchable PDFs efficiently.
To explore more functionalities, you can demo all of the pdfRest API Tools in the API Lab. For more detailed information, refer to the API Reference Guide.
Note: This is an example of a multipart API call. Code samples using JSON payloads can be found at GitHub.
Create your FREE API Key to start processing PDFs in seconds, only possible with pdfRest.