Merge PDF Files in Python
Import pages from multiple PDF files and export the combined content as one PDF document with Python
Merge PDF in Python
Aspose.Slides for Python via .NET
lets you combine PDF files by importing their pages into a Presentation. SlideCollection.add_from_pdf converts each PDF page into a slide and appends it to the presentation.
After all source files are imported, call Presentation.save with SaveFormat.PDF to export the slides as one PDF document. Microsoft PowerPoint and Adobe Acrobat are not required.
Merge PDF files using Python
Create a presentation without its default blank slide, import the source PDF files in the required order, and export the combined slides as one PDF document.
Python code for merging PDF files
with slides.Presentation() as presentation:
presentation.slides.remove_at(0)
presentation.slides.add_from_pdf("document1.pdf")
presentation.slides.add_from_pdf("document2.pdf")
presentation.save("merged.pdf", slides.export.SaveFormat.PDF)
How to merge PDF using Aspose.Slides for Python API
These are the steps to merge PDF files in Python.
Install Aspose.Slides for Python via .NET .
Create an empty
Presentation.Remove the default blank slide from the presentation.
Pass each source PDF file to
SlideCollection.add_from_pdfin the required order.Call
Presentation.savewith the output file path andSaveFormat.PDF.
Export PDF to Other Supported Formats
You can also combine PDF files and save the imported pages in other supported formats.