Skip to main content

Splitting a PDF into pages

Splitting a PDF into pages will allow you to break the document down into multiple pages using the PDF.API.

The splitNumber parameter dictates how many pages per PDF document you desire.

Example 1

If you supply a PDF document that has 5 pages and the splitNumber parameter = 2, the output will be 3 documents in total:

  • the first document with 2 pages
  • another document with 2 pages
  • the final document with 1 page

Example 2

If you supply a PDF with 5 pages and the splitNumber = 1, the output will be 5 documents each containing 1 page.

The important thing to remember is that splitting keeps the original order of the document.

You can view the full Swagger documentation here.

Request

curl --location 'https://pdf-api.doclabs.cloud/api/v1/MyDocumentWith5Pages.pdf/intopages?storageName=MyBucketName' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ••••••' \
--data '{
"splitNumber": 2
}'

Response

{
"bucketName": "MyBucketName",
"contentPathNames": [
"DocumentWith2Pages.pdf",
"DocumentWith2Pages.pdf",
"DocumentWith1Pages.pdf"
]
}