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  markup annotation class.

        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: 

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_APPROVED = 'Approved'

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

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_AS_IS = 'AsIs'

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

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_CONFIDENTIAL = 'Confidential'

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

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_DEPARTMENTAL = 'Departmental'

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

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_DRAFT = 'Draft'

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

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_EXPERIMENTAL = 'Experimental'

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

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_EXPIRED = 'Expired'

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

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_FINAL = 'Final'

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

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_FOR_COMMENT = 'ForComment'

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

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_FOR_PUBLIC_RELEASE = 'ForPublicRelease'

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

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_NOT_APPROVED = 'NotApproved'

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

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_NOT_FOR_PUBLIC_RELEASE = 'NotForPublicRelease'

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

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_SOLD = 'Sold'

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

        const string SetaPDF_Core_Document_Page_Annotation_Stamp::ICON_TOP_SECRET = 'TopSecret'

        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();