PHP code example of karriere / pdf-merge

1. Go to this page and download the library: Download karriere/pdf-merge 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/ */

    

karriere / pdf-merge example snippets


use Karriere\PdfMerge\PdfMerge;

$pdfMerge = new PdfMerge();

$pdfMerge->add('/path/to/file1.pdf');
$pdfMerge->add('/path/to/file2.pdf');

$pdfMerge->merge('/path/to/output.pdf');

$pdfMerge->contains('/path/to/file.pdf');

use Karriere\PdfMerge\PdfMerge;

$pdfMerge = new PdfMerge(
        new HeaderConfig(
            imagePath: 'header_logo.png',
            logoWidthMM: 20,
            title: 'Header',
            text: 'This is a header text',
            textColor: new RGB(200, 200, 200),
            lineColor: new RGB(0, 0, 255),
        ),
        new FooterConfig(
            textColor: new RGB(100, 100, 100),
            lineColor: new RGB(255, 0, 0),
            margin: 20,
        ),
    );