PDF Rotate Pages
PDF utilities (change rotation, fix rotation, delete pages etc)
Available Methods
[POST] /pdf/edit/rotate
Rotates selected pages inside PDF file.
Attributes |
---|
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 a 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 to learn more. |
angle optional angle in degrees. Supported values 90 , 180 , and 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 the index to the last page use range like this: 2- (from page #3 as the index starts at zero and till the 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. Data must need to be in a “string” format. |
async optional Runs processing asynchronously and returns JobId that you may use with /job/check to check the state of the processing (possible states: working , failed , aborted and success ). Must be one of: true , or false . |
profiles optional Use this parameter to set additional configurations for fine-tuning and extra options. Data must need to be in a “string” format. Explore PDF.co knowledgebase for profile examples. |
- Method: POST
- URL: /v1/pdf/edit/rotate
Query parameters
No query parameters accepted.
Body payload
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/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://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-optimize/sample.pdf",
"name": "result.pdf",
"angle": 90,
"pages": "0-2,4"
}'
[POST] /pdf/edit/rotate/auto
Uses AI to automatically to fix the rotation of pages inside scanned PDF based on text analysis. To change text language change the lang
parameter (eng
by default).
Attributes |
---|
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 a 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 to learn more. |
lang optional Set the language for OCR (text from image) to use for scanned PDF, PNG, and JPG documents input when extracting text. The 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 . |
async optional Runs processing asynchronously and returns JobId that you may use with /job/check to check the state of the processing (possible states: working , failed , aborted and success ). Must be one of: true , or false . |
profiles optional Use this parameter to set additional configuration for fine-tuning and extra options. Data must need to be in a “string” format. 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://pdfco-test-files.s3.us-west-2.amazonaws.com/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://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-fix-rotation/rotated_pages.pdf",
"name": "result.pdf"
}'
Copyright © 2016 - 2023 PDF.co