Guide
How to rotate PDF pages in C#
Use page.RotateAsync(...) when you want to rotate one page, or
SetRotationAsync(...) when you want the same rotation applied across the whole document.
The rotation values are exposed through Rotation helpers such as
Rotation.Degrees90.
Rotate one page
Get the page you want to change, apply the rotation, and save.
using ZingPDF;
using ZingPDF.Elements;
using var pdf = Pdf.Load(File.OpenRead("input.pdf"));
using var output = File.Create("page-rotated.pdf");
var page = await pdf.GetPageAsync(1);
await page.RotateAsync(Rotation.Degrees90);
await pdf.SaveAsync(output);
Rotate the whole document
If every page should use the same rotation, apply it at the document level.
using var pdf = Pdf.Load(File.OpenRead("input.pdf"));
await pdf.SetRotationAsync(Rotation.Degrees90);
await pdf.SaveAsync(File.Create("document-rotated.pdf"));
Rotation values
The high-level API exposes the common right-angle rotations:
Rotation.NoneRotation.Degrees90Rotation.Degrees180Rotation.Degrees270
Need to add or remove pages too?
Rotation often sits next to page insertion, deletion, or append operations in the same write path.