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.

Import Outlines to Root Outline

This demo shows you how to copy outlines to the root bookmark outline of the final PDF document.

PHP
<?php

use setasign\SetaPDF2\Core\Document\PageMode;
use setasign\SetaPDF2\Core\Writer\HttpWriter;
use setasign\SetaPDF2\Merger\Merger;

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

$merger = new Merger();

$merger->addFile([
    'filename' => $assetsDirectory . '/pdfs/Brand-Guide.pdf',
    'outlinesConfig' => [
        Merger::OUTLINES_COPY => Merger::COPY_OUTLINES_TO_ROOT
    ]
]);

$merger->addFile([
    'filename' => $assetsDirectory . '/pdfs/Fuchslocher-Example.pdf',
    'outlinesConfig' => [
        Merger::OUTLINES_COPY => Merger::COPY_OUTLINES_TO_ROOT
    ]
]);

// merger
$merger->merge();

// get the resulting document instance
$document = $merger->getDocument();

// show outlines when document opens
$document->getCatalog()->setPageMode(PageMode::USE_OUTLINES);

$document->setWriter(new HttpWriter('outlines-in-root.pdf', true));
$document->save()->finish();