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.

Remove Usage Rights

Usage rights enable specifc features, such as form filling or annotating, in PDF reader applications (today this feature is nearly obsolete because common reader support these features out of the box). This works with special kind of digital signatures which will become invalid if you make changes to the document which are not allowed. So it is a common task to remove these things if you are going to modify the PDF document.

This demo let you check for these usage rights and remove them.

PHP
<?php

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

// prepare some files
$files = [
    $assetsDirectory . '/pdfs/forms/Sunnysunday-Example-ReaderEnabled.pdf',
    $assetsDirectory . '/pdfs/forms/Sunnysunday-Example.pdf',
];

$path = displayFiles($files, false);

// create a document
$document = \SetaPDF_Core_Document::loadByFilename($path);

$permissions = $document->getCatalog()->getPermissions();

// check for usage right
if ($permissions->hasUsageRights()) {
    // remove them
    $permissions->removeUsageRights();

    // save the document
    $document->setWriter(new \SetaPDF_Core_Writer_Http('no-usage-rights.pdf'));
    $document->save()->finish();
} else {
    echo 'No usage rights found.';
}