Merge PDF Files in Python

Merge PDF Files using Python and DOM

To concatenate two PDF files:

  1. Create a New Document.
  2. Merge the PDF Files
  3. Save the Merged Document

Combining multiple PDF documents into a single file:

import sys
import aspose.pdf as ap
from os import path

def merge_two_documents(infile1, infile2, outfile):
    document1 = ap.Document(infile1)
    document2 = ap.Document(infile2)
    document1.pages.add(document2.pages)
    document1.save(outfile)

Live Example

Aspose.PDF Merger is an online free web application that allows you to investigate how presentation merging functionality works.

Aspose.PDF Merger