eDocEngine VCL Professional Help » Symbol Reference » Namespaces of Helper Classes » gtExPDFEng Namespace » TgtPDFTextMarkupAnnot Class

Gnostice eDocEngine VCL Developer Guide
TgtPDFTextMarkupAnnot Class

This class represents a markup annotation.

Pascal
public TgtPDFTextMarkupAnnot = class(TgtPDFAnnot);
C++
public: class TgtPDFTextMarkupAnnot : public TgtPDFAnnot;
Description

A markup annotation is used to mark up some text or part of a page. The markup style can be a color highlight, a squiggly line, a strikeout, or an underline. The location of the markup can be specified as an array of points representing the corners of the rectangular area in the following order - top-left corner, top-right corner, bottom-left corner, and bottom-right corner.

gtExPDFEng

procedure TForm1.Demo_TgtPDFTextMarkupAnnot;
var
  gtPDFTextMarkupAnnot1: TgtPDFTextMarkupAnnot;
  aQuadPoints1: Array [0 .. 3] of TgtPoint;
  sSentence: String;
  iMarkupBegin, iMarkupEnd: Double;
  gtPDFEngine1: TgtPDFEngine;
begin
  gtPDFEngine1 := TgtPDFEngine.Create(Nil);

  with gtPDFEngine1 do
  begin
    Preferences.ShowSetupDialog := False;
    Preferences.OpenAfterCreate := True;
    FileName := 'text_annotation.pdf';

    BeginDoc; // Create a PDF document

    sSentence := 'One two three';
    // X-coordinates to markup the word "two"
    // in the above string
    iMarkupBegin := 1 + TextSize('One ', Font).cx / 96;
    iMarkupEnd := iMarkupBegin + (TextSize('two', Font).cx / 96);

    // Create a markup annotation
    gtPDFTextMarkupAnnot1 := TgtPDFTextMarkupAnnot.Create;
    gtPDFTextMarkupAnnot1.TextStyle := tsHighlight;
    gtPDFTextMarkupAnnot1.SetQuadPoints(
      [gtPoint(iMarkupBegin, 0.95), gtPoint(iMarkupEnd, 0.95),
       gtPoint(iMarkupBegin, 1.15), gtPoint(iMarkupEnd, 1.15)]);
    gtPDFTextMarkupAnnot1.BorderColor := clLime;
    gtPDFTextMarkupAnnot1.Title := 'Markup Annotation Demo';
    gtPDFTextMarkupAnnot1.Contents :=
      'This markup annotation is used to highlight page elements.';

    // Write the whole string
    TextOut(1, 1, sSentence);
    // Add the annotation to the current page
    AddAnnotItem(gtPDFTextMarkupAnnot1);
    EndDoc; // Save the PDF document
  end;
end;

 

Properties
TgtPDFTextMarkupAnnot Class
 
Name 
Description 
 
Specifies border color of the annotation. 
 
Specifies text that needs to be used as the contents of the annotation's popup window. 
 
Specifies text that needs to be used as the subject in the annotation's popup window. 
 
Specifies style of the markup. 
 
Specifies text that needs to be used as the title in the annotation's popup window. 
Methods
TgtPDFTextMarkupAnnot Class
 
Name 
Description 
 
Creates a new instance of this class. 
 
Destroys this instance. 
 
Specifies locations of the corners of the quadrilateral area where the text markup annotation will be displayed.