How to Change Page Size of PDF using C#

This concise tutorial shows you how to change page size of PDF using C#. It walks you through setting up the development environment, outlines each step to build the application, and provides ready‑to‑run example code that changes the size of a PDF page with just a few API calls. The sample works on any operating system that supports the .NET framework, including Windows, Linux, and macOS.

Steps to Change PDF Paper Size using C#

  1. Establish the environment to use Conholdate.Total for .NET to change page size
  2. load the source PDF file into the Document class object whose page dimensions are to be changed
  3. Get a reference to the collection of pages in the loaded PDF
  4. Get a reference to the target page from the collection whose size is to be updated
  5. Call the SetPageSize() method of the Page class and provide a new page size
  6. Save the resultant PDF file with an updated page size

This guide shows the process to edit PDF page size using C#, starting by providing the necessary resource for testing this feature. Next, we load the specific PDF file, go to its collection of pages, and get a reference to the page we want to resize. Within the page class, there’s a SetPageSize() method, which lets you adjust the page’s dimensions by specifying its width and height.

Code to Modify PDF Page Size using C#

In this example we show how to change the size of a PDF page using C#. Aspose.PDF uses a 72‑points‑per‑inch scale, so convert any measurement from inches to points by multiplying the inch value by 72. For instance, to resize a page to Envelope 10# (4.13 in wide × 9.49 in high), first multiply 4.13 and 9.49 by 72 to get the dimensions in points, then feed those values into the SetPageSize() method.

We’ve just walked through changing PDF page dimensions using C#. Ready to take the next step? Learn how to add a watermark to a PDF by checking out the article on how to add watermark to PDF in C#.

 English