HTML
JPG
PDF
XML
DOCX
PDF
How to rotate PDF via Cloud .NET SDK
To rotate PDF documents, we’ll use Aspose.PDF Cloud .NET SDK This Cloud SDK allows you to easily build cloud-based PDF creator, editor & converter apps in C#, ASP.NET, or other .NET languages for various cloud platforms. Open NuGet package manager, search for Aspose.PDF Cloud and install. You may also use the following command from the Package Manager Console.
Package Manager Console Command
PM> Install-Package Aspose.Pdf-Cloud
Steps to Rotate PDF using .NET SDK
Aspose.PDF Cloud developers can easily load & Rotate PDF in just a few lines of code.
- Upload the PDF to the cloud.
- Set Parameters for Page Rotation.
- Rotate the specified pages using the desired angle.
- Download the modified PDF.
Rotate PDF using .NET Cloud SDK
public static async Task RotatePages()
{
const string localPdfFileName = @"C:\Samples\sample.pdf";
const string storageFileName = "sample.pdf";
const string localFolder = @"C:\Samples";
const string resultFileName = "output_rotate.pdf";
const string storageTempFolder = "YourTempFolder";
const string rotationPages = "1, 3 - 5, 8";
// Get your AppSid and AppSecret from https://dashboard.aspose.cloud (free registration required).
pdfApi = new PdfApi(AppSecret, AppSid);
using var file = File.OpenRead(localPdfFileName);
await pdfApi.UploadFileAsync(Path.Combine(storageTempFolder, storageFileName), file);
AsposeResponse response = await pdfApi.PostDocumentPagesRotateAsync(storageFileName, Rotation.On90.ToString(), rotationPages, folder: storageTempFolder);
if (response.Code != 200)
Console.WriteLine("RotatePages(): Unexpected error!");
else {
using Stream downloadStream = pdfApi.DownloadFile(Path.Combine(storageTempFolder, storageFileName));
using FileStream localStream = File.Create(Path.Combine(localFolder, resultFileName));
downloadStream.CopyTo(localStream);
Console.WriteLine("RotatePages(): Pages '{0}' successfully rotated!", rotationPages);
}
}