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.

Rotate Page

This demo shows you how to rotate PDF pages.

PHP
<?php

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

$files = [
    $assetsDirectory . '/pdfs/Brand-Guide.pdf',
    $assetsDirectory . '/pdfs/camtown/Terms-and-Conditions.pdf',
    $assetsDirectory . '/pdfs/etown/Laboratory-Report.pdf',
];

$path = displayFiles($files);

// create a file writer
$writer = new \SetaPDF_Core_Writer_Http('rotated.pdf', true);
// load document by filename
$document = \SetaPDF_Core_Document::loadByFilename($path, $writer);

// get pages object
$pages = $document->getCatalog()->getPages();
// get page count
$pageCount = $pages->count();

for ($pageNumber = 1; $pageNumber <= $pageCount; $pageNumber++) {
    // get page object for this page
    $page = $pages->getPage($pageNumber);

    // rotate by...
    $page->rotateBy(90);
}

// save and finish the document
$document->save()->finish();