PDF Rotate Pages#
Available Methods#
/pdf/edit/rotate#
Rotates selected pages inside a PDF file.
Method: POST
Endpoint: /v1/pdf/edit/rotate
Attributes#
Note
Attributes are case-sensitive and should be inside JSON for POST request, for example:
{
"url": "https://example.com/file1.pdf"
}
Attribute |
Description |
Required |
---|---|---|
|
URL to the source file. 1 |
yes |
|
Angle in degrees. Supported values |
no |
|
HTTP auth user name if required to access source |
no |
|
HTTP auth password if required to access source |
no |
|
Comma-separated indices of pages (or page ranges) that you want to use. The first-page index is always 0. For example, if you have a 7-page document that you want to be split into 3 separate PDFs but a different number of pages it would go like this: 0, 1, 2- or 1, 2, 3-7 which will result in 1 PDF with page one, 1 PDF with page two and one PDF with the rest of the pages. You can also use inverted page numbers adding |
no |
|
Set |
no |
|
Use this parameter to set additional configurations for fine-tuning and extra options. Explore the Profiles section for more. |
no |
Query parameters#
No query parameters accepted.
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"
}
Response 2#
{
"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
}
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"
}'
/pdf/edit/rotate/auto#
Uses AI to automatically fix the rotation of pages inside scanned PDF based on text analysis. To change text language change the lang
parameter (eng
by default).
Method: POST
Endpoint: /v1/pdf/edit/rotate/auto
Attributes#
Note
Attributes are case-sensitive and should be inside JSON for POST request, for example:
{
"url": "https://example.com/file1.pdf"
}
Attribute |
Description |
Required |
---|---|---|
|
URL to the source file. 1 |
yes |
|
Set the language for OCR (text from image) to use for scanned PDF, PNG, and JPG documents input when extracting text. The default is |
no |
|
HTTP auth user name if required to access source |
no |
|
HTTP auth password if required to access source |
no |
|
Set |
no |
|
Use this parameter to set additional configurations for fine-tuning and extra options. Explore the Profiles section for more. |
no |
Query parameters#
No query parameters accepted.
Payload#
{
"url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/pdf-fix-rotation/rotated_pages.pdf",
"name": "result.pdf"
}
Response 2#
{
"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
}
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"
}'
Footnotes
- 1(1,2)
Supports links from Google Drive, Dropbox, and PDF.co Built-In Files Storage. To upload files via the API check out the File Upload section. Note: If you experience intermittent Too Many Requests or Access Denied errors, please try to add
cache:
to enable built-in URL caching. (e.gcache:https://example.com/file1.pdf
) For data security, you have the option to encrypt output files and decrypt input files. Learn more about user-controlled data encryption.- 2(1,2)
Response codes as follows:
Code
Description
200
The request has succeeded
400
Bad input parameters
401
Unauthorized
403
Not enough credits
405
Timeout error. To process large documents or files please use asynchronous mode (set the
async
parameter totrue
) and then check status using the /job/check endpoint. If a file contains many pages then specify a page range using thepages
parameter. The number of pages of the document can be obtained using the /pdf/info endpoint.