Let us explore the scenarios related to rotation in PDF documents. There might be situations where you might have an inverted scanned PDF document that you need to fix. You can fix such a document by rotating the pages of the document. You might also want to add text or image watermarks to a PDF document by rotating them. To that end, this article will teach you how to rotate PDF pages, text, and images programmatically using C++.

C++ API for Rotating PDF Pages, Text, and Images

Aspose.PDF for C++ is a C++ library that allows you to create, read and update PDF documents. In addition to this, the API supports rotating PDF pages, text, and images. You can either install the API through NuGet or download it directly from the downloads section.

PM> Install-Package Aspose.PDF.Cpp

Rotate PDF Pages using C++

Rotating pages with Aspose.PDF for C++ is a breeze. With just a few lines of code, you can rotate all the pages of the PDF document. The following are the steps to rotate PDF pages using C++.

The following sample code shows how to rotate PDF pages using C++.

Rotating Text on PDF Pages using C++

While adding text to PDF documents, you can change many text properties, including its angle. In the following example, we will add text to a PDF page and rotate it at an angle of 45 degrees. The following are the steps to achieve that.

The following sample code demonstrates how to rotate text on a PDF page using C++.

Rotate an Image on a PDF Page using C++

While adding images to PDF documents, you can set many properties like height, width, opacity, rotation, etc. In this example, we will add an image to a PDF page and rotate it at an angle of 90 degrees. The following are the steps to rotate an image on a PDF page.

The following sample code shows how to rotate an image on a PDF page using C++.

Get a Free License

You can try the API without evaluation limitations by requesting a free temporary license.

Conclusion

In this article, you have learned how to rotate pages, text, and images in PDF documents using C++. Aspose.PDF for C++ is a vast API that provides many additional features for working with PDF files. You can explore the API in detail by visiting the official documentation. In case of any questions, please feel free to reach us on our free support forum.

See Also