Remove Pages
PSPDFKit Processor lets you delete pages of a document using the removePages
operation.
Before you get started, make sure Processor is up and running.
Removing Pages of a File on Disk
Send a request to the /process
endpoint, attaching an input file and the operations JSON:
curl -X POST http://localhost:5000/process \ -F file=@/path/to/example.pdf \ -F operations='{ "operations": [ { "type": "removePages", "pageIndexes": [ "first" ] } ] }' \ -o result.pdf
POST /process HTTP/1.1 Content-Type: multipart/form-data; boundary=customboundary --customboundary Content-Disposition: form-data; name="file"; filename="example.pdf" Content-Type: application/pdf <PDF data> --customboundary Content-Disposition: form-data; name="operations" Content-Type: application/json { "operations": [ { "type": "removePages", "pageIndexes": [ "first" ] } ] } --customboundary--
This will remove the first page of the document.
Removing Pages of a File from a URL
Send a request to the /process
endpoint, attaching a URL pointing to an input file and the operations JSON:
curl -X POST http://localhost:5000/process \ -F url=https://pspdfkit.com/downloads/examples/paper.pdf \ -F operations='{ "operations": [ { "type": "removePages", "pageIndexes": [ "first" ] } ] }' \ -o result.pdf
POST /process HTTP/1.1 Content-Type: multipart/form-data; boundary=customboundary --customboundary Content-Disposition: form-data; name="url" https://pspdfkit.com/downloads/examples/paper.pdf --customboundary Content-Disposition: form-data; name="operations" Content-Type: application/json { "operations": [ { "type": "removePages", "pageIndexes": [ "first" ] } ] } --customboundary--
This will remove the first page of the document.