PHP code example of aleswita / pdfmerger

1. Go to this page and download the library: Download aleswita/pdfmerger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

aleswita / pdfmerger example snippets


use AlesWita;

final class HomePresenter extends BasePresenter
{
  /** @var AlesWita\PdfMerger @inject */
  public $pdfMerger;

  ...
  
  public function handleMergePdf(array $files): void {
    foreach ($files as $file) {
      $this->pdfMerger->addPdf($file);
    }
  
    $this->pdfMerger->setOutputFile("test.pdf")
      ->merge();
  }
}