Skip to main content

Posts

Showing posts with the label merge PDF files

Merge PDF Files in Java

In this article, I will introduce two methods to merge PDF files in Java application. 1. Merge PDF files into a single file 2. Merge a specific page or a page range of a PDF file into another PDF file The below examples use Free Spire.PDF for Java library. Imported NameSpace: import com.spire.pdf.PdfDocument; import com.spire.pdf.PdfDocumentBase; Merge PDF files into a single file String[] files = new String[] { "file1.pdf" , "file2.pdf" }; //load PDF files PdfDocumentBase pdf = PdfDocument. mergeFiles (files); //merge into a single file pdf.save( "MergeFiles.pdf" );   Merge a specific page or a page range of a PDF file into another PDF file String[] files = new String[]         {                 "file1.pdf" ,                 "file2.pdf" ,   ...