Merge PDF in PHP
High-speed and cross-platform PHP library for merging PDF files using PHP code
Merge PDF to PDF using Aspose.Slides
Aspose.Slides for PHP via Java is a powerful PHP library used to create, convert, merge, and manipulate presentations, PDFs, and other documents. When you merge PDF to PDF, you are effectively combining pages from 2 documents to obtain one PDF file. Aspose.Slides allows you merge PDFs in different ways. You get to merge PDFs with all their shapes, styles, texts, formatting, etc.
Merge PDF to PDF in PHP
Using Aspose.Slides for PHP via Java , you can merge PDF files quickly with just a few lines of code
PHP code for merging PDF to PDF
<?php
require_once("http://localhost:8080/JavaBridge/java/Java.inc");
require_once("lib/aspose.slides.php");
$pres = new Presentation();
try
{
$pres->getSlides()->removeAt(0);
$pres->getSlides()->addFromPdf("document1.pdf");
$pres->getSlides()->addFromPdf("document2.pdf");
$pres->save("merged-pdf.pdf", SaveFormat::Pdf);
}
finally
{
if ($pres != null) $pres->dispose();
}
?>
How to merge PDF in PHP
Install Aspose.Slides for PHP via Java. See Installation .
Add the library as a reference in your project.
Create an instance of the Presentation class.
Load the PDF files you want to merge.
Save the resulting PDF.
Merge PDF Files Online
Merge other files
You can also combine files in other formats to get a single file