SetaPDF Demos

There seems to be a problem loading the components. Please check your PHP error logs for details!

Common issues could be that you missed to install the trial license or that you are using a trial version on an unsupported PHP version.

Merge With Layers

This demo shows you how to merge PDF documents including their layer information.

PHP
<?php

// load and register the autoload function
require_once __DIR__ . '/../../../../../bootstrap.php';

$merger = new \SetaPDF_Merger();

// copy layer information from this document
$merger->addFile([
    'filename' => $assetsDirectory . '/pdfs/layers/rect+circle+polygon.pdf',
    'copyLayers' => true // default
]);

// don't copy layer information from this document
$merger->addFile([
    'filename' => $assetsDirectory . '/pdfs/layers/rect+circle+triangle.pdf',
    'copyLayers' => false
]);

// copy the same document a 2nd time but also copy layer information (default behavior)
$merger->addDocument(
    \SetaPDF_Core_Document::loadByFilename($assetsDirectory . '/pdfs/layers/rect+circle+triangle.pdf')
);

$merger->merge();

$document = $merger->getDocument();

$document->setWriter(new \SetaPDF_Core_Writer_Http('layers.pdf', true));
$document->save()->finish();