Delete PDF Page API

Remove one or more pages from a PDF with our PDF page deletion API.

Try It Out

This example takes the first three pages, skips the fourth one, and then appends the rest, effectively deleting page four.

1

Use Your Free Credits

Sign up to get 100 free credits, or log in to automatically add your API key to sample code.

Add a File

Add a PDF named document.pdf to your project folder. You can also use our sample file. The file name is case sensitive. Make sure the file name matches the file name in the sample code.

Run a Command

Copy the curl command and run it in that same folder via the terminal or your editor’s terminal. This sample code uses a zero index to call on the specific pages of the document. Change which page is deleted by adjusting the end and start numbers. If you want to omit the second page, set end to 0 and start to 2.

View the Results

Open result.pdf in your project folder to view the results.

Shell
    curl -X POST https://api.pspdfkit.com/build \
        -H "Authorization: Bearer your_api_key_here" \
        -o result.pdf \
        -F document=@document.pdf \
        -F instructions='{
            "parts": [
              { "file": "document", "pages": { "end": 2 } },
              { "file": "document", "pages": { "start": 4 } }
            ]
          }'

            
Using Postman? Download our official collection and start using the API with a single click. Read more 

Your API Key