How to Merge PDF using Python
Merge or combine multiple PDF into single PDF in Python
Combining PDF files is a very popular query among users This can be useful when you have several PDF files that you want to share or store together as one document.
Merging PDF files can help you organize your documents, make room for storage on your PC, and share several PDF files with others by combining them into one document.
Merging PDF in Python via .NET is not straightforward task without using 3rd party library. This article shows how to merge multiple PDF files into a single PDF document using Aspose.PDF for Python via .NET.
Merge PDF Files using Python and DOM
To concatenate two PDF files:
- Create a New Document.
- Merge the PDF Files
- Save the Merged Document
Combining multiple PDF documents into a single file:
import aspose.pdf as apdf
import aspose.pydrawing as asdrw
from io import FileIO
from os import path
path_infile1 = path.join(self.dataDir, infile1)
path_infile2 = path.join(self.dataDir, infile2)
path_outfile = path.join(self.dataDir, outfile)
document = apdf.Document()
document.merge(files=[path_infile1, path_infile2])
document.save(path_outfile)
Live Example
Aspose.PDF Merger is an online free web application that allows you to investigate how presentation merging functionality works.