API Overview
PSPDFKit Processor provides a simple HTTP-based API for working with documents.
Processing a Document
To process a document, submit a multipart/form-data
request to the POST /process
API endpoint.
Available headers for POST /process
:
- Required —
Authorization
— This is where you pass in your JSON Web Token (JWT). - Optional —
pspdfkit-pdf-password
— This is where you pass in the password required for the PDF document to be processed. If not set and a password is required, the request will fail.
Available parameters for POST /process
:
- Required —
"file"
or"url"
."file"
— The document that should be processed."url"
— A URL the document that should be processed can be fetched from.
- Required —
"operations"
— The JSON object describing the operations that should be performed on the supplied document. For all available operations, see here. - Optional — Attachment data for the operations — for example, the XFDF that should be imported when using the
applyXfdf
document operation.
Request
Copy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | POST /process Content-Type: multipart/form-data; boundary=customboundary Authorization: Token token="JWT Token" pspdfkit-pdf-password: "PDF Password" --customboundary Content-Disposition: form-data; name="file"; filename="Example Document.pdf" Content-Type: application/pdf <Document data> --customboundary Content-Disposition: form-data; name="operations" Content-Type: application/json <Operations JSON> --customboundary-- |
Copy
1 2 3 4 5 | curl -H "Authorization: Token token=JWT_TOKEN" \ -F file=@Example.pdf \ -F operations="{\"operations\":[{\"type\": \"flattenAnnotations\"}]}" \ http://localhost:5000/process \ --output result.pdf |
Response
1 2 3 4 | HTTP/1.1 200 OK Content-Type: application/pdf <PDF data> |
To see the Processor in action, refer to the Usage Examples guide.