Articles in this section
Category / Section

How to convert A4 to A3 PDF using C# and VB.NET

3 mins read

Syncfusion Essential PDF is a .NET PDF library used to create, read, and edit PDF documents. Using this library, you can convert A4 size PDF to A3 size PDF document using C# and VB.NET.

Steps to convert A4 size PDF to A3 size PDF programmatically:

  1. Create a new C# Windows Forms application project. New C# Window Forms application project
  2. Install the Syncfusion.Pdf.WinForms NuGet package as reference to your .NET Framework application from NuGet.org. NuGet package reference screenshot
  3. Include the following namespaces in the Form1.Designer.cs file.

C#

using Syncfusion.Pdf;
using Syncfusion.Pdf.Parsing;
using Syncfusion.Pdf.Graphics;
using System.Drawing;

 

VB.NET

Imports Syncfusion.Pdf
Imports Syncfusion.Pdf.Parsing
Imports Syncfusion.Pdf.Graphics
Imports System.Drawing

 

  1. Use the following code snippet to convert A4 size PDF to A3 size PDF.

C#

//Load a PDF document
PdfLoadedDocument ldoc = new PdfLoadedDocument("input.pdf");
//Create a new instance of PdfDocument class
PdfDocument document = new PdfDocument();
//Set page margin value as 0
document.PageSettings.Margins.All = 0;
//Set page size as A3
document.PageSettings.Size = PdfPageSize.A3;
for (int i = 0; i < ldoc.Pages.Count; i++)
{
    //Get loaded page as template
    PdfTemplate template = ldoc.Pages[i].CreateTemplate();
    //Create new page
    PdfPage page = document.Pages.Add();
    //Create Pdf graphics for the page 
    PdfGraphics g = page.Graphics;
    //Draw template with the size as page size
    g.DrawPdfTemplate(template, new PointF(0, 0), new SizeF(page.GetClientSize().Width, page.GetClientSize().Height));
}
//Save and Close the document
document.Save("A3SizePDF.pdf");
document.Close(true);

 

VB.NET

'Load a PDF document
Dim ldoc As PdfLoadedDocument = New PdfLoadedDocument("input.pdf")
'Create a new instance of PdfDocument class
Dim document As PdfDocument = New PdfDocument()
'Set page margin value as 0
document.PageSettings.Margins.All = 0
'Set page size as A3
document.PageSettings.Size = PdfPageSize.A3
For i = 0 To ldoc.Pages.Count - 1
'Get loaded page as template
Dim template As PdfTemplate = ldoc.Pages.Item(i).CreateTemplate()
'Create new page
Dim page As PdfPage = document.Pages.Add()
'Create Pdf graphics for the page 
Dim g As PdfGraphics = page.Graphics
'Draw template with the size as page size
g.DrawPdfTemplate(template, New PointF(0, 0), New SizeF(page.GetClientSize().Width, page.GetClientSize().Height))
Next
'Save and Close the document
document.Save("A3SizePDF.pdf")
document.Close(True)
'Close the Loaded PDF document
ldoc.Close(True)

 

A complete working sample can be downloaded from ConvertA4ToA3PDF.zip.

By executing the program, you will get the PDF document as follows. PDF Document after program execution

Take a moment to peruse the documentation for working with document, where you will find other options like page rotation, orientation, and transition in the PDF document.

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

An online sample link to adding pages with different settings such as rotation, orientation, page size and transition.

Note:

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.

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied