Skip to main content

pdf-text


Use the pdf-text endpoint to extract text from a PDF.

Use the pdf-text endpoint to extract text from a PDF. It uses an HTTP POST to send a PDF as binary and then returns the extracted text as a JSON response.

Request/Response

RequestRequest DataResponse
POSTPDF as byte arrayJSON document containing PDF text.

The pdf-text endpoint takes an HTTP POST form submission, where the PDF is sent as binary in the form's body.

POST https://api.dpdf.io/v1.0/pdf-text HTTP/1.1
Authorization: Bearer DP.xxx-api-key-xxx
info

Refer to pdf-text in the Client Libraries Users Guide section for this example using the DynamicPDF API's client libraries.

Parameters

The endpoint takes two optional query parameters, startPage and pageCount.

ParameterTypeDescription
Query String
startPageintegerThe page to start extracting text.
pageCountintegerThe number of pages to extract text.
Request BodyType
BodybinaryThe PDF document to send to the endpoint.REQUIRED
HeaderValue
Content-Typeapplication/pdfContent type sent in request.
AuthorizationBearer DP.V9xxxxxxxxxxxxxxxThe API key.REQUIRED
important

The PDF is sent to the endpoint as binary data. In this example request, the binary is coming from a file, but it could also come from a URL, a database, or other source.

Run In Postman

Example cURL Request

curl -X POST "https://api.dpdf.io/v1.0/pdf-text?startPage=1&pageCount=2"
-H "accept: application/json"
-H "Authorization: Bearer DP.xxx-api-key-xxx"
-H "Content-Type: application/pdf"
--data-binary "@c:/holding/pdf-text/fw4.pdf"

Example Response

[
{
"pageNumber": 1,
"text": "[DynamicPDF Evaluation] Form W-4\n(Rev. December 2020)\nDepartment of the Treasury \nInternal Revenue Service \nEmployee’s Withholding Certificate\n ▶ Complete Form W-4 so that your employer can withhold the correct federal income tax from your pay. \n ▶ Give Form W-4 to your empl ....[Text Truncated - Please purchase a license or contact support for an evaluation license.]"
},
{
"pageNumber": 2,
"text": "[DynamicPDF Evaluation] Form W-4 (2021) Page 2\nGeneral Instructions\nFuture Developments\nFor the latest information about developments related to \nForm W-4, such as legislation enacted after it was published, \ngo to www.irs.gov/FormW4 .\nPurpose of Form\nComplete Form W-4 so that yo ....[Text Truncated - Please purchase a license or contact support for an evaluation license.]"
}
]

Further Information

You can also use one of DynamicPDF's provided client libraries to integrate the endpoints into your client applications if you prefer. For more information, refer to the relevant Users Guide sections:

   Follow us on social media for latest news!