Change PDF Page Size with C#
Change PDF Page Size
Aspose.PDF for .NET lets you change PDF page size with simple lines of code in your .NET applications. This topic explains how to update/change the page dimensions (size) of an existing PDF file.
The Page class contains the SetPageSize(…) method which lets you set the page size. The code snippet below updates page dimensions in a few easy steps:
- Load the source PDF file.
- Get the pages into the PageCollection object.
- Get a given page.
- Call the SetPageSize(..) method to update its dimensions.
- Call the Document class’ Save(..) method to generate the PDF file with updated page dimensions.
The following code snippet shows how to change the PDF page dimensions to A4 size.
Get PDF Page Size
You can read PDF page size of an existing PDF file using Aspose.PDF for .NET. The following code sample shows how to read PDF page dimensions using C#.