English
  1. Home
  2. Page
  3. Rotate

Rotate

Rotate PDF document

copy
Something went wrong, try again
copy
            
                    
        
Body parameter
Parameter VALUE DESCRIPTION

rotateRequest

Required

copy
RotateRequest RotatePageRequest Instance
RotateRequest
Parameter VALUE DESCRIPTION

PdfBase64File

Required

close-icon
string Base64 encoded PDF document to process

RotationAngle

Required

RotationAngle Rotation Angle (CKW). Can be 90, 180, 270.

Pages

Optional

string Comma separated list of page numbers of result document. Page numbering starts from 1. Example: "2,4,1,7"
copy Copy to clipboard
        
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api.conholdate.cloud/v5.0/pdf/page/rotate"
  method := "POST"

  payload := strings.NewReader(`{
      "RotationAngle": "On90",
      "Pages": "some value",
      "PdfBase64File": "Base64 encoded file...",
    }`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
                   
         
            
File file = new File("path/to/file/fileName.pdf");
byte[] encoded = Base64.encodeBase64(FileUtils.readFileToByteArray(file));
String base64EncodedFile = new String(encoded, StandardCharsets.US_ASCII);

OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, 
    "{" +
      "\"RotationAngle\": \"On90\"," +
      "\"Pages\": \"\some value\"," +
      "\"PdfBase64File\": \"" + base64EncodedFile + "\"," +
    "}");

Request request = new Request.Builder()
  .url("https://api.conholdate.cloud/v5.0/pdf/page/rotate")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .build();

Response response = client.newCall(request).execute();
                   
        
            
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://api.conholdate.cloud/v5.0/pdf/page/rotate',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS =>'{
      "RotationAngle": "On90",
      "Pages": "some value",
      "PdfBase64File": "Base64 encoded file...",
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
                   
        
            
import requests
import json

url = "https://api.conholdate.cloud/v5.0/pdf/page/rotate"

json_data = json.dumps({
      "RotationAngle": "On90",
      "Pages": "some value",
      "PdfBase64File": "Base64 encoded file...",
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=json_data)

print(response.text)
                   
        
            
curl --location --request POST 'https://api.conholdate.cloud/v5.0/pdf/page/rotate' \
--header 'Content-Type: application/json' \
--data-raw '{
      "RotationAngle": "On90",
      "Pages": "some value",
      "PdfBase64File": "Base64 encoded file...",
}'
                   
        
            
require "uri"
require "json"
require "net/http"

url = URI("https://api.conholdate.cloud/v5.0/pdf/page/rotate")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = JSON.dump({
      "RotationAngle": "On90",
      "Pages": "some value",
      "PdfBase64File": "Base64 encoded file...",
})

response = https.request(request)
puts response.read_body

                   
        
            
var client = new RestClient("https://api.conholdate.cloud/v5.0/pdf/page/rotate");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
var body = "{" + 
      "\"RotationAngle\": \"On90\"," +
      "\"Pages\": \"\some value\"," +
      "\"PdfBase64File\": \"" + base64EncodedFile + "\"," +
"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
                       
            
Overview

About Rotate Method

Explore our detailed documentation that provides step-by-step instructions on how to utilize our cloud-based API to rotate PDF files in a variety of programming languages, including Go, Java, PHP, Python, Curl, Ruby, and C#. With our Document API's "Rotate" method, you can easily rotate a single page or a range of pages in a PDF document while preserving its quality to the maximum extent possible. To specify the pages for rotation, simply use a comma-separated list of pages and page ranges, such as 1,3-5,8. Empower your PDF files with precise page rotation capabilities using our versatile and powerful API.


Programming languages the API is compatible with

The API uses the REST protocol, making it compatible with a wide range of programming languages, including but not limited to: Go, Java, PHP, Python, Curl, Ruby, C#.

Easy to use

Our API Reference and Guide are designed to be user-friendly and easy to follow, providing all the necessary information for a quick start. Furthermore, our API Libraries are accompanied by their own documentation, making integration into your application seamless. With our comprehensive resources, you can efficiently utilize our API to meet your specific requirements.

Secure

At our company, we place a high priority on your security and privacy. To protect your private data, we never store it in our environment and offer isolated options. We understand the importance of keeping your information safe and take all necessary measures to ensure that it remains secure.
Rotate Page
clock
Add a File
To ensure smooth and accurate file processing and page rotation using the "Rotate" method (Page API), it is essential to verify that the file you are working with matches the one specified in the method. This ensures that the page rotation is applied correctly to the intended PDF file, ensuring a successful outcome and preserving the integrity of your document.
arrow
clock
Run the Code
To run the code, copy and paste it into a file and execute it from the same directory where you added the necessary files. For further details, refer to our language-specific guides on how to get started.
arrow
clock
View the Result
To view the results of the "Rotate" method (Page API), you can easily open the file received as the output, which should be located in your project folder. If you choose to utilize the "Rotate" method online to rotate pages in your PDF file, the process will automatically generate a PDF file with the rotated pages, which will be conveniently downloaded for you to access. This seamless process allows you to quickly and effortlessly apply page rotation to your PDF files for enhanced usability and readability.
clock
How long does it takes to rotate pages in PDF file using "Rotate" method (Page API)?
Our Page API, specifically the "Rotate" method, is designed to provide efficient and speedy file processing. With our service, you can expect rapid results, often delivered within a matter of seconds. Experience the speed and efficiency of our API, enabling you to quickly rotate pages in your PDF files and streamline your workflow for optimal productivity.
clock
It is safe to rotate pages in a PDF file using Page API?
We understand the importance of ensuring the safety and privacy of your data. Rest assured that our company takes extensive measures to protect your information. We do not store any files you submit for getting metadata and process them only to provide you with the results. Your security and confidentiality are our utmost priorities.
clock
What output can I expect from the "Rotate" method (Page API)?
The "Rotate" method (Page API) empowers you to easily rotate a single page or a specific range of pages in your PDF document, making it more convenient for viewing or reading. With the flexibility of using comma-separated lists of pages and page ranges (e.g., 1,3-5,8), you have the freedom to independently choose which pages or page range to rotate, giving you full control over the orientation of your PDF document. You can also set the angle of rotation: 90, 180, 270. Enhance the usability and readability of your PDF files with our versatile "Rotate" method, tailored to your specific needs.
clock
How does method “Rotate” (Page API) works?
The "Rotate" method (Page API) enables you to effortlessly rotate pages or a specific range of pages in your PDF file. Our user-friendly and seamless process allows you to easily upload your file, click the "POST" button, and await the results. Within just a few seconds, you'll receive a file with rotated. If you wish to integrate this method into your project, you can conveniently copy and use the provided code examples in the programming language of your choice. Enhance the usability and readability of your PDF files with our efficient "Rotate" method, tailored to meet your specific requirements.
FAQ

Frequently Asked Questions

We encourage you to review our Frequently Asked Questions (FAQ) section for answers to common inquiries. If you do not find the information you need, our dedicated support service is readily available to assist you with any additional questions or concerns. Don't hesitate to reach out for further assistance.