We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to create a PDF with different page sizes in C# and VB.NET

Platform: WinForms |
Control: PDF
Tags: pdf, c#, size, page

Syncfusion Essential PDF is a .NET PDF Library used to create, read, and edit PDF documents. Using this library, you can create a PDF document with different page sizes.

Steps to create a PDF document with different page sizes programmatically:

  1. Create a new C# console application project. Title: Create a console application project
  2. Install the Syncfusion.Pdf.WinForms NuGet package as reference to your .NET Framework application from NuGet.org. Title: NuGet reference
  3. Including the following namespace in the Program.cs file.


using Syncfusion.Pdf;



Imports Syncfusion.Pdf


  1. Use the following code snippet to create a PDF document with different page size.


//Create a new PDF document 
PdfDocument document = new PdfDocument();
//Add a page with A5 size
PdfSection section1 = document.Sections.Add();
section1.PageSettings.Size = PdfPageSize.A5;
PdfPage page1 = section1.Pages.Add();
//Add a page with A3 size
PdfSection section2 = document.Sections.Add();
section2.PageSettings.Size = PdfPageSize.A3;
PdfPage page2 = section2.Pages.Add();
//Save and close the document
//This will open the PDF file so, the result will be seen in default PDF viewer



'Create a new PDF document 
Dim document As PdfDocument = New PdfDocument()
'Add a page with A5 size
Dim section1 As PdfSection = document.Sections.Add()
section1.PageSettings.Size = PdfPageSize.A5
Dim page1 As PdfPage = section1.Pages.Add()
'Add a page with A3 size
Dim section2 As PdfSection = document.Sections.Add()
section2.PageSettings.Size = PdfPageSize.A3
Dim page2 As PdfPage = section2.Pages.Add()
'Save and close the document 
'This will open the PDF file so, the result will be seen in default PDF viewer


A complete working sample can be download from PDFSample.zip.

Take a moment to peruse the documentation for working with pages, where you can find the options like inserting, rotating, importing, and rearranging the pages from an existing document, removing the pages and splitting a PDF file to individual pages.

Refer here to explore the rich set of Syncfusion Essential PDF features.


Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile