Text Markup Annotation Classes Highlight, Underline, Strikeout and Jagged/Squiggly Underline

Table of Contents

  1. Introduction
    1. Methods
      1. Example

        Introduction

        Text markup annotations shall appear as highlights, underlines, strikeouts, or jagged (“squiggly”) underlines in the text of a document. They are represented in SetaPDF by following classes:

        All of them are both a text markup and markup annotation

        Methods

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

        getQuadPoints()

        Get the Quadpoints.

        setQuadPoints()

        Set the Quadpoints.

        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 highlight annotation
        $annotation = new SetaPDF_Core_Document_Page_Annotation_Highlight(array(50, 680, 70, 700));
        $annotation->setContents("A simple highlight annotation.");
        $annotation->setTextLabel("John Dow"); // Used as Author in a Reader application
        $annotation->setColor(array(1, 0, 0));
        $annotation->setSubject('A sticky note to a highlight annotation');
        $annotations->add($annotation);
        
        // create the popup
        $popup = $annotation->createPopup();
        $annotations->add($popup);
        // assign the popup to the text annotation
        $annotation->setPopup($popup);
        
        $document->save()->finish();