Rubber Stamp Annotation Class

Table of Contents

  1. Introduction
    1. Methods
      1. Example

        Introduction

        A rubber stamp annotation displays text or graphics intended to look as if they were stamped on the page with a rubber stamp. It is represented by the SetaPDF_Core_Document_Page_Annotation_Stamp class which also implements the  SetaPDF_Core_Document_Page_Annotation_Markup.

        The PDF format specifies several icon names that shall be used in displaying the annotation. These icons are represented via class constants in SetaPDF too: 

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Icon name defined in PDF 32000-1:2008 - 12.5.6.12 Rubber Stamp Annotations

        Methods

        The classes implements getter and setter methods to access the individual annotation data:

        getIconName()

        Get the icon name of the annotation.

        setIconName()

        Set the name of the icon that shall be used in displaying the annotation.

        Example

        PHP
        <?php
        require_once('library/SetaPDF/Autoload.php');
        
        $writer = new SetaPDF_Core_Writer_Http('text-markup-annotation.pdf', true);
        $document = new SetaPDF_Core_Document($writer);
        
        // let's create a page
        $pages = $document->getCatalog()->getPages();
        $page = $pages->create(SetaPDF_Core_PageFormats::A4);
        
        $annotations = $page->getAnnotations();
        
        // create a rubber stamp annotation
        $annotation = new SetaPDF_Core_Document_Page_Annotation_Stamp(array(50, 680, 170, 760));
        $annotations->add($annotation);
        
        $annotation = new SetaPDF_Core_Document_Page_Annotation_Stamp(
            array(50, 580, 170, 660),
            SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_APPROVED
        );
        $annotation->setPrintFlag(); // will be visible on print
        $annotations->add($annotation);
        
        $document->save()->finish();