Merge PDF files using Python

High-speed, powerful, and secure API for merging PDF documents in Python


PDF merge API allows you to combine and merge multiple PDF files. Using PDF Merge API, you can retain the numbering of the pages, remove duplicate fonts to increase performance, and even create a table of contents for the merged documents.

Merge PDF documents programmatically

ConvertAPI provides a PDF Merge tool available as a REST API service. In addition, we provide a Python SDK for effortless integration into your project. It is accessible via pip, and the source code can be found on GitHub. Simply sign up for a free account, grab your API secret key, install our Pyhon library, and you are good to go!

Install the ConvertAPI library into the Python project

Install using pip:

pip install --upgrade convertapi

Or install from the source with:

python install

Merge PDF files using Python

Once you have the library installed, you can use this code example to join multiple PDF files using Python programming language:

import convertapi
import os
import tempfile

# Code snippet is using the ConvertAPI Python Client:
# Read more about PDF Merge API:

convertapi.api_secret = 'your-api-secret'
convertapi.convert('merge', {
    Files: [
}, from_format = 'pdf').save_files('/path/to/dir')

That's all it takes to implement a PDF merge functionality into the Python project. You can combine local PDF files together with the files hosted on a server accessible via the URL, or the files uploaded to our server accessible by FileId.

Advanced techniques

You can find a complete list of conversion parameters on our interactive demo tool page. More advanced techniques and examples can be found in our GitHub examples folder. Happy coding!