How to merge multiple A4 PDFs to A3 PDF using C#

1.9k Views Asked by At

Here i want to merge two Individual A4 PDFs to A3 PDFs.The A4 PDF pages should be fit into A3 2-ups that is side by side view.

I didn't tried any code still now but before i want to know is this possible?

Note : A4 PDFs can have "N" number of pages not single page PDF.

HERE is graphical image example:

enter image description here

2

There are 2 best solutions below

3
Farhan Raza On BEST ANSWER

You may concatenate two PDF documents into a single PDF document containing all A4 size pages. Then you can use MakeNUp method which is exposed by PdfFileEditor class, in order to get 1 row and 2 columns on A3 size output document. Below code snippet is basic implementation of suggested approach:

// Open first document
Document pdfDocument1 = new Document(dataDir + "PDF1.pdf");
// Open second document
Document pdfDocument2 = new Document(dataDir + "PDF2.pdf");
// Add pages of second document to the first OR vice versa
pdfDocument1.Pages.Add(pdfDocument2.Pages);
// Save concatenated output file
pdfDocument1.Save(dataDir + "Concatenate.pdf");

//Final step of organizing pages as per your requirements
PdfFileEditor editor = new PdfFileEditor();
editor.MakeNUp(dataDir + "Concatenate.pdf", dataDir + "output.pdf", 2, 1 , PageSize.A3);

For further details and information, you may visit below links:

PS: I work with Aspose as Developer Evangelist.

0
Uladzimir Asipchuk On

It's well explained in these official iText examples how to achieve it:

iText7 https://github.com/itext/i7js-examples/blob/develop/src/test/java/com/itextpdf/samples/sandbox/merge/MakeBookletA3.java

iText5 https://github.com/itext/i5js-sandbox/blob/master/src/main/java/sandbox/merge/MakeBookletA3.java

The code is in Java, but there should be no problem to port the samples to C#, because the API is quite the same.