Merge PDF Guide

Develop your own solution to combine multiple PDF files by integrating with iLovePDF’s REST API.

New to the API? Start with Processing a PDF: every tool guide builds on its task flow.

Basic merge

Merge is one of the simplest iLoveAPI tools to use and can be done by simply uploading two or more files, as shown in this example code:

Examples using a library
// Create a new task
$myTaskMerge = $ilovepdf->newTask('merge');
// Add files to task for upload
$file1 = $myTaskMerge->addFile('path/to/file1_name.pdf');
$file2 = $myTaskMerge->addFile('path/to/file2_name.pdf');
// Execute the task
$myTaskMerge->execute();
// Download the package files
$myTaskMerge->download();
PHP library ilovepdf/ilovepdf-phpcomposer require ilovepdf/ilovepdf-php

In this example, file1_name.pdf and file2_name.pdf will be merged into a single PDF with a default filename.


Merge is that simple. Remember that you can explore more functions like setting the output filename in the Common functions guide.