PDF Stamp


The PDF stamp class allows you to use a page of an existing PDF document as a stamp appearance.

It's only the pages content stream that will be transformed into a reusable structure. By doing this, content types like links, form fields or other kind of page annotations will loose their relation and will not be available in the final stamp appearance.

Create an Instance

An instance could be created by passing a filename or a document instance, a page number and a boundary box to its constructor: 

$stamp = new \SetaPDF_Stamper_Stamp_Pdf(
    'path/to/stamp.pdf', 1, \SetaPDF_Core_PageBoundaries::CROP_BOX

// or

$document = \SetaPDF_Core_Document::loadByFilename('path/to/stamp.pdf');
$stamp = new \SetaPDF_Stamper_Stamp_Pdf(
    $document, 1, \SetaPDF_Core_PageBoundaries::CROP_BOX

Configure Properties

Beside the general stamp properties the PDF stamp class offers following stamp properties: 

Source Document Specific

Following methods are available to control which page and boundary box should be used from the initial document instance: 


Get the current boundary box name.


Get the page number of the page that should be used for the stamp appearance.


Set the boundary box of the imported page.


Set the page number for the page which should be used for the stamp appearance.



Get the height of the pdf page stamp.


Get the width of the pdf page stamp.


Set the individual height if the pdf page stamp.


Set the individual width of the pdf page stamp.


The example simply uses the first page of this document as the stamp appearance: 

 * Adds an imported page (a vector logo) on the top left position for all pages


// create a writer
$writer = new \SetaPDF_Core_Writer_Http('image.pdf', true);
// get a document instance
$document = \SetaPDF_Core_Document::loadByFilename(
    'files/pdfs/Fact-Sheet-without-personalization.pdf', $writer

// create a stamper instance
$stamper = new \SetaPDF_Stamper($document);

// initiate the stamp
$stamp = new \SetaPDF_Stamper_Stamp_Pdf(
// set height (and width until no setWidth is set the ratio will retain)

// add stamp to stamper on position left top for all pages with a specific translation
$stamper->addStamp($stamp, array(
    'translateX' => 43,
    'translateY' => -38

// stamp the document

// save and send it to the client