Link Search Menu Expand Document

PDF Delete Pages

Explore Samples

PDF utilities (change rotation, fix rotation, delete pages etc)

Available Methods

[POST] /pdf/edit/rotate

Rotates selected pages inside PDF file.

  • url required. URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly getting Too Many Requests or Access Denied error for your input url, please try to add cache: to enable built-in url caching. You can also encrypt data for output files and decrypt data input files with user-controlled data encryption (uses strong AES encryption with your own keys). Click here to learn more.
  • angle angle in degrees. Supported values 90, 180, 270.
  • httpusername (optional) - http auth user name if required to access source url.
  • httppassword (optional) - http auth password if required to access source url.
  • pages. optional. Comma-separated list of page indices (or ranges) to process. IMPORTANT: the very first page starts at 0 (zero). To set a range use the dash -, for example: 0,2-5,7-. To set a range from index to the last page use range like this: 2- (from page #3 as the index starts at zero and till the end of the document). For ALL pages just leave this param empty. Example: 0,2-5,7- means first page, then 3rd page to 6th page, and then the range from 8th (index = 7) page till the end of the document. Must be a String.
  • profiles optional. Must be a String. Use this param to set additional configuration for fine tuning and extra options. Explore PDF.co knowledgebase for profile examples.

  • Method: POST
  • URL: /v1/pdf/edit/rotate

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-optimize/sample.pdf",
    "name": "result.pdf",
    "angle": 90,
    "pages": "0-2,4"
}

Example responses

/pdf/edit/rotate
{
    "url": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/2EK4QYIZU1XUEUH853VTSK47NPLXCUYX/result.pdf?X-Amz-Expires=3600&X-Amz-Security-Token=FwoGZXIvYXdzEFsaDC5Vfgoi83YzdW9HXiKCAYBVHK096wqoUyu8Ckq8jEhV1DBv9VzHY1EcPWvfG3L2YrFa8QC5ZMr3UhFEn4%2B%2B2u6e%2FcdZd%2FXbdVaI45yNE%2Btz28UHMVxCQUClj9kCHrMyJ4W1%2BlnDgLi9JUHt7SkIvV9Lj7GLDBOXy22KCND86HdtPg0uT%2FNQtcjJm%2F34cISImKYov63NlQYyKG%2BEO%2FQLP%2BzJuugBdSLcKUOTL52dnc1l82ye1u5kYvTlbfPMdisU1tY%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA4NRRSZPHESTCUXXF/20220623/us-west-2/s3/aws4_request&X-Amz-Date=20220623T135902Z&X-Amz-SignedHeaders=host&X-Amz-Signature=78f2fe7f22ebd1fc2c329a855c7582f9deb09c0c5045281b9b2420a5afb792cf",
    "fileSize": 1064923,
    "pageCount": 4,
    "error": false,
    "status": 200,
    "name": "result.pdf",
    "credits": 28,
    "duration": 245,
    "remainingCredits": 98194839
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/edit/rotate' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-optimize/sample.pdf",
    "name": "result.pdf",
    "angle": 90,
    "pages": "0-2,4"
}'

[POST] /pdf/edit/rotate/auto

Uses AI to automatically to fix rotation of pages inside scanned PDF based on text analysis. To change text language change lang parameter (eng by default).

  • url required. URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly getting Too Many Requests or Access Denied error for your input url, please try to add cache: to enable built-in url caching. You can also encrypt data for output files and decrypt data input files with user-controlled data encryption (uses strong AES encryption with your own keys). [Click here](/kb/User%20Controlled%20encryption/encryption-and-decryption-options) to learn more.
  • lang optional. Sets language for OCR (text from image) to use for scanned PDF, PNG, JPG documents input when extracting text. Default is “eng”. Other languages are also supported: deu, spa, chi_sim, jpn and many others (full list of supported OCR languages is here. You can also use 2 languages simultaneously like this: eng+deu or jpn+kor (any combination).
  • httpusername (optional) - http auth user name if required to access source url.
  • httppassword (optional) - http auth password if required to access source url.
  • profiles optional. Must be a String. Use this param to set additional configuration for fine tuning and extra options. Explore PDF.co knowledgebase for profile examples.

  • Method: POST
  • URL: /v1/pdf/edit/rotate/auto

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-fix-rotation/rotated_pages.pdf",
    "name": "result.pdf"
}

Example responses

/pdf/edit/rotate/auto
{
    "url": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/HQ86WA7MFED1Q7C843NDSKVRW5AFVTMP/result.pdf?X-Amz-Expires=3600&X-Amz-Security-Token=FwoGZXIvYXdzEFwaDD6ndEhlfId4KouQ8yKCASr8amowIV2tLAi%2BhjnlVi%2FNYjf8ZJ3MqgKWsYVm5dQ8fQx7hceGdmtqhB6OH8t9xdacbMEcoMIpQr1BcSSfu2ZFfGFBDaHNpaSTfPXhkNnQaZFOi5KFozZiPBP9xPoSCV%2Fj%2BLIrDsOF%2Fb89i1Nd4OJFoXnfhjf03ZHJ%2BNCQEC%2BbePsovsjNlQYyKIV1qb1wGdwgJ%2ByibJ5x%2BQGoG4x2ebnEGTQkKBf4zobYT9Uv6FVQ%2FJg%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA4NRRSZPHB3D5EZ56/20220623/us-west-2/s3/aws4_request&X-Amz-Date=20220623T141005Z&X-Amz-SignedHeaders=host&X-Amz-Signature=351ad45980cad0d3f634f7b784d5445b9c4e1ad2244912f56ea065209d73bb30",
    "fileSize": 455115,
    "pageCount": 3,
    "error": false,
    "status": 200,
    "name": "result.pdf",
    "credits": 84,
    "duration": 6002,
    "remainingCredits": 98194629
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/edit/rotate/auto' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-fix-rotation/rotated_pages.pdf",
    "name": "result.pdf"
}'

[POST] /pdf/edit/delete-pages

  • url required. URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly getting Too Many Requests or Access Denied error for your input url, please try to add cache: to enable built-in url caching. You can also encrypt data for output files and decrypt data input files with user-controlled data encryption (uses strong AES encryption with your own keys). Click here to learn more.
  • httpusername (optional) - http auth user name if required to access source url.
  • httppassword (optional) - http auth password if required to access source url.

  • pages optional. Comma-separated list of page indices (or ranges) to remove. IMPORTANT: the very first page starts at 1 (one). To set a range use the dash -, for example: 1,2-5,7-. To set a range from index to the last page use range like this: 2-. For ALL pages just leave this param empty. Must be a String.

  • name optional. File name for generated output. Must be a String.
  • expiration (optional). Output link expiration in minutes. Default is 60 (i.e. 60 minutes or 1 hour). After this delay generated output file(s) (if any) will be auto-removed from PDF.co temporary files storage. Max allowed expiration period depends on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf, documents), please use PDF.co built-in Files Storage instead.
  • profiles optional. Must be a String. Use this param to set additional configuration for fine tuning and extra options. Explore PDF.co knowledgebase for profile examples.

  • Method: POST
  • URL: /v1/pdf/edit/delete-pages

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-split/sample.pdf",
    "pages": "1-2",
    "name": "result.pdf",
    "async": false
}

Example responses

/pdf/edit/delete-pages
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/d15e5b2c89c04484ae6ac7244ac43ac2/result.pdf",
    "pageCount": 2,
    "error": false,
    "status": 200,
    "name": "result.pdf",
    "remainingCredits": 60100
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/edit/delete-pages' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://bytescout-com.s3.amazonaws.com/files/demo-files/cloud-api/pdf-split/sample.pdf",
    "pages": "1-2",
    "name": "result.pdf",
    "async": false
}'

Samples