PDF Merger

No downloads or installation required!

Merge PDFs using our free online app or learn how it works with our embedded iText 8 Sandbox.


Use the free online PDF Merger app

Click the box below to upload your PDFs, or drag and drop your PDFs into the box. Make sure you upload only two PDFs.

You will then be presented with the merge options. You can choose to reorder the files, or select which pages to merge from each PDF. The default option is to merge "All" pages, but you can choose to merge the PDFs from specific pages if you wish.

 

Click Merge PDFs and download the resulting merged PDF.

Or play in the iText 8 Sandbox

In this Sandbox you can see how the the merging code works in iText 8, and experiment with changing the code yourself.

Upload two PDFs to merge with the Upload File button. Once you have uploaded one file, click the button again to upload the second file. To remove an uploaded file, click the x displayed next to the file name.

Make sure the file names of the PDFs you upload match the names you specify in private static final String ORIG FILE1 and private static final String ORIG FILE2. Click Execute to run your code.

You can click the switch at the top of the Sandbox to change between the embedded Java and C# compiler.

import com.itextpdf.kernel.pdf.PdfDocument; import com.itextpdf.kernel.pdf.PdfReader; import com.itextpdf.kernel.pdf.PdfWriter; import com.itextpdf.kernel.utils.PdfMerger; import java.io.IOException; public class PdfMerge { private static final String FILE1 = "/uploads/first.pdf"; private static final String FILE2 = "/uploads/second.pdf"; private static final String OUTPUT_FOLDER = "/myfiles/"; public static void main(String args[]) throws IOException { PdfDocument pdfDocument = new PdfDocument(new PdfReader(FILE1), new PdfWriter(OUTPUT_FOLDER + "merged.pdf")); PdfDocument pdfDocument2 = new PdfDocument(new PdfReader(FILE2)); PdfMerger merger = new PdfMerger(pdfDocument); merger.merge(pdfDocument2, 1, pdfDocument2.getNumberOfPages()); pdfDocument2.close(); pdfDocument.close(); } }
using iText.Kernel.Pdf; using iText.Kernel.Utils; namespace PDFMerge { public class PDFMerge { private static string FILE1 = "/uploads/first.pdf"; private static string FILE2 = "/uploads/second.pdf"; private static string OUTPUT_FOLDER = "/myfiles/"; static void Main(string[] args) { PdfDocument pdfDocument = new PdfDocument(new PdfReader(FILE1), new PdfWriter(OUTPUT_FOLDER + "merged.pdf")); PdfDocument pdfDocument2 = new PdfDocument(new PdfReader(FILE2)); PdfMerger merger = new PdfMerger(pdfDocument); merger.Merge(pdfDocument2, 1, pdfDocument2.GetNumberOfPages()); pdfDocument2.Close(); pdfDocument.Close(); } } }
Disclaimer:

iText does not analyze the content of your uploaded or processed files. Users bear sole responsibility for the usage and content of their own files. All uploaded and processed files are deleted from our servers after users leave the page, or automatically after a period of 3 hours.



Contact

Still have questions? 

We're happy to answer your questions. Reach out to us and we'll get back to you shortly.

Contact us
Stay updated

Join 11,000+ subscribers and become an iText PDF expert by staying up to date with our new products, updates, tips, technical solutions and happenings.

Subscribe Now