Rotate PDF pages in C++
Contents
[
Hide
]
Set the rotation of every PDF page to 90 degrees using Aspose.PDF for C++.
Set all pages to 90-degree rotation
The example sets an absolute rotation value of 90 degrees rather than adding 90 degrees to the existing rotation.
- Open the input PDF as a Document.
- Iterate through every Page.
- Set Rotate to on90 from Rotation.
- Save the result with Save().
#include <Aspose.PDF.Cpp/Document.h>
#include <Aspose.PDF.Cpp/Page.h>
#include <Aspose.PDF.Cpp/PageCollection.h>
#include <Aspose.PDF.Cpp/Rotation.h>
using namespace System;
using namespace Aspose::Pdf;
// Port of RotatePagesExamples.rotatePage.
void RotatePage(System::String inputFile, System::String outputFile)
{
auto document = MakeObject<Document>(inputFile);
for (const auto& page : document->get_Pages()) {
page->set_Rotate(Rotation::on90);
}
document->Save(outputFile);
}