PHP code example of signerphp / pdf-core

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

    

signerphp / pdf-core example snippets


use SignerPHP\PdfCore\Service\PdfDocumentPreparer;
use SignerPHP\PdfCore\Service\IncrementalUpdateWriter;
use SignerPHP\PdfCore\PdfValue\PDFValueString;

$document = (new PdfDocumentPreparer)->prepare(file_get_contents('input.pdf'));
$info = $document->getObject($document->getTrailerObject()['Info']->asObjectReferenceOrNull());
$info['Title'] = new PDFValueString('Updated title');
$document->addObject($info);
file_put_contents('output.pdf', (new IncrementalUpdateWriter)->write($document)->raw());