pdftron::PDF::Annots::FreeText Class Reference

A FreeText annotation (PDF 1.3) displays text directly on the page. More...

#include <FreeText.h>

Inheritance diagram for pdftron::PDF::Annots::FreeText:

Inheritance graph
[legend]
Collaboration diagram for pdftron::PDF::Annots::FreeText:

Collaboration graph
[legend]

List of all members.

Public Types

enum  IntentName { e_FreeText, e_FreeTextCallout, e_FreeTextTypeWriter, e_Unknown }
 This enum defines the intention of the FreeText annotation. More...

Public Member Functions

 FreeText (SDF::Obj d=0)
 Creates a FreeText annotation and initializes it using given Cos/SDF object.
 FreeText (const Annot &ann)
 Creates a FreeText annotation and initializes it using given annotation object.
UString GetDefaultAppearance () const
 Returns the default appearance of the FreeText annotation.
void SetDefaultAppearance (const char *app_str)
 Sets the default appearance of the FreeText annotation.
int GetQuaddingFormat () const
 Returns the quading format of the FreeText annotation.
void SetQuaddingFormat (const int app_qform)
 Sets the quading format of the FreeText annotation.
void GetCalloutLinePoints (Point &p1, Point &p2, Point &p3) const
 Returns the callout line points of the FreeText annotation.
void SetCalloutLinePoints (const Point &p1, const Point &p2, const Point &p3)
 Sets the callout line points of the FreeText annotation.
void SetCalloutLinePoints (const Point &p1, const Point &p2)
 Sets the callout line points of the FreeText annotation.
IntentName GetIntentName () const
 Returns Intent name of the FreeText annotation.
void SetIntentName (IntentName mode=e_FreeText)
 Sets the Intent name of the FreeText annotation.
Line::EndingStyle GetEndingStyle () const
 Returns the ending style of the callout line of the FreeText Annotation.
void SetEndingStyle (Line::EndingStyle est)
 Sets the ending style of the callout line of the FreeText Annotation.
void SetEndingStyle (const char *est)
 Sets the ending style of the callout line of the FreeText Annotation.
void SetTextColor (const ColorPt &color, int col_comp)
 Sets the text color of the FreeText Annotation.
void GetTextColor (ColorPt &color, int &col_comp)
 Returns the text color of the FreeText Annotation.
void SetLineColor (const ColorPt &color, int col_comp)
 Sets the line and border color of the FreeText Annotation.
void GetLineColor (ColorPt &color, int &col_comp)
 Returns the line and border color of the FreeText Annotation.

Static Public Member Functions

static FreeText Create (SDF::SDFDoc &doc, const Rect &pos)
 Creates a new FreeText annotation in the specified document.


Detailed Description

A FreeText annotation (PDF 1.3) displays text directly on the page.

Unlike an ordinary Text annotation, a FreeText annotation has no open or closed state; The content of the FreeText annotation is always visible instead of being displayed in a popup window.


Member Enumeration Documentation

This enum defines the intention of the FreeText annotation.

Enumerator:
e_FreeText  The annotation intended to function as a plain FreeText annotation.
e_FreeTextCallout  The annotation is intended to function as a callout.
e_FreeTextTypeWriter  The annotation is intended to function as a click-to-type or typewriter object and no callout line is drawn.
e_Unknown  User defined or Invalid.


Constructor & Destructor Documentation

pdftron::PDF::Annots::FreeText::FreeText ( SDF::Obj  d = 0  ) 

Creates a FreeText annotation and initializes it using given Cos/SDF object.

Note:
The constructor does not copy any data, but is instead the logical equivalent of a type cast.

pdftron::PDF::Annots::FreeText::FreeText ( const Annot ann  )  [inline]

Creates a FreeText annotation and initializes it using given annotation object.

Note:
The constructor does not copy any data, but is instead the logical equivalent of a type cast.


Member Function Documentation

static FreeText pdftron::PDF::Annots::FreeText::Create ( SDF::SDFDoc doc,
const Rect pos 
) [static]

Creates a new FreeText annotation in the specified document.

Parameters:
doc A document to which the FreeText annotation is added.
pos A rectangle specifying the FreeText annotation's bounds in default user space units.
Returns:
A newly created blank FreeText annotation.

UString pdftron::PDF::Annots::FreeText::GetDefaultAppearance (  )  const

Returns the default appearance of the FreeText annotation.

Returns:
A string representing the default appearance of the annotation.
Note:
The default appearance string is used to format the text. The annotation dictionary’s Appearance entry, if present, will take precedence over this entry.

this method corresponds to the 'DA' entry in the annotation dictionary.

void pdftron::PDF::Annots::FreeText::SetDefaultAppearance ( const char *  app_str  ) 

Sets the default appearance of the FreeText annotation.

Parameters:
app_str A string representing the default appearance of the annotation.
Note:
The default appearance string is used to format the text. The annotation dictionary’s Appearance entry, if present, will take precedence over this entry.

this method corresponds to the 'DA' entry in the annotation dictionary.

int pdftron::PDF::Annots::FreeText::GetQuaddingFormat (  )  const

Returns the quading format of the FreeText annotation.

(PDF 1.4)

Returns:
A int (code) indicating the quading format of the FreeText annotation.
Note:
The following are the quading formats corresponding to each int code. 0 Left-justified 1 Centered 2 Right-justified

void pdftron::PDF::Annots::FreeText::SetQuaddingFormat ( const int  app_qform  ) 

Sets the quading format of the FreeText annotation.

(Optional; PDF 1.4)

Parameters:
app_qform A int code indicating the quading format of the FreeText annotation. Default value: 0 (left-justified).
Note:
The int code specifies the form of quadding (justification) that shall be used in displaying the annotation’s text: 0 Left-justified 1 Centered 2 Right-justified

void pdftron::PDF::Annots::FreeText::GetCalloutLinePoints ( Point p1,
Point p2,
Point p3 
) const

Returns the callout line points of the FreeText annotation.

(PDF 1.6)

Parameters:
p1 The starting point.
p2 The ending point.
p3 The knee point.
Returns:
Three point objects if the line is bent or two point objects if the line is straight.
Note:
If the line is straight, i.e. only has two points, two points will be returned in p1 and p2, and p3 will be the same as p2. The coordinates are given in default user space.

void pdftron::PDF::Annots::FreeText::SetCalloutLinePoints ( const Point p1,
const Point p2,
const Point p3 
)

Sets the callout line points of the FreeText annotation.

(Optional; meaningful only if IT is FreeTextCallout; PDF 1.6)

Parameters:
p1 The starting point.
p2 The ending point.
p3 The knee point.
Note:
The coordinates are defined in default user space.

void pdftron::PDF::Annots::FreeText::SetCalloutLinePoints ( const Point p1,
const Point p2 
)

Sets the callout line points of the FreeText annotation.

(Optional; meaningful only if IT is FreeTextCallout; PDF 1.6)

Parameters:
p1 The staring point.
p2 The ending point.
Note:
The coordinates are defined in default user space.

IntentName pdftron::PDF::Annots::FreeText::GetIntentName (  )  const

Returns Intent name of the FreeText annotation.

(PDF 1.4)

Returns:
The intent name of the annotation as an entry from the enum "IntentName".

void pdftron::PDF::Annots::FreeText::SetIntentName ( IntentName  mode = e_FreeText  ) 

Sets the Intent name of the FreeText annotation.

(Optional; PDF 1.4)

Parameters:
mode The intent name of the annotation as an entry from the enum "IntentName".

Line::EndingStyle pdftron::PDF::Annots::FreeText::GetEndingStyle (  )  const

Returns the ending style of the callout line of the FreeText Annotation.

Returns:
The ending style represented as one of the entries of the enum "EndingStyle"
Note:
The ending style specifies the line ending style that shall be used in drawing the callout line specified in CallOut Line Points (CL). The enum entry shall specify the line ending style for the endpoint defined by the starting point(p1) of the CallOut Line Points. Default value: e_None.

void pdftron::PDF::Annots::FreeText::SetEndingStyle ( Line::EndingStyle  est  ) 

Sets the ending style of the callout line of the FreeText Annotation.

(Optional; meaningful only if CL is present; PDF 1.6)

Parameters:
est The ending style represented using one of the entries of the enum "EndingStyle"
Note:
The ending style specifies the line ending style that shall be used in drawing the callout line specified in CallOut Line Points (CL). The enum entry shall specify the line ending style for the endpoint defined by the starting point(p1) of the CallOut Line Points. Default value: e_None.

void pdftron::PDF::Annots::FreeText::SetEndingStyle ( const char *  est  ) 

Sets the ending style of the callout line of the FreeText Annotation.

(Optional; meaningful only if CL is present; PDF 1.6)

Parameters:
est The ending style represented using a string.
Note:
The ending style specifies the line ending style that shall be used in drawing the callout line specified in CallOut Line Points (CL). The enum entry shall specify the line ending style for the endpoint defined by the starting point(p1) of the CallOut Line Points. Default value: "None".

void pdftron::PDF::Annots::FreeText::SetTextColor ( const ColorPt color,
int  col_comp 
)

Sets the text color of the FreeText Annotation.

Parameters:
color ColorPt object representing the color.
col_comp number of colorant components in ColorPt object.
Note:
Current implementation of this method creates a non-standard entry in the annotation dictionary and uses it to generate the appearance stream. Make sure you call RefreshAppearance() after changing text or line color, and remember that editing the annotation in other PDF applications will produce different appearance.

void pdftron::PDF::Annots::FreeText::GetTextColor ( ColorPt color,
int &  col_comp 
)

Returns the text color of the FreeText Annotation.

Parameters:
color reference to ColorPt object, where results will be saved.
col_comp reference to an integer, where number of colorant components will be written.
Note:
Current implementation of this method uses a non-standard entry in the annotation dictionary and will not return meaningful results when called on annotations not created with PDFTron software.

void pdftron::PDF::Annots::FreeText::SetLineColor ( const ColorPt color,
int  col_comp 
)

Sets the line and border color of the FreeText Annotation.

Parameters:
color ColorPt object representing the color.
col_comp number of colorant components in ColorPt object.
Note:
Current implementation of this method creates a non-standard entry in the annotation dictionary and uses it to generate the appearance stream. Make sure you call RefreshAppearance() after changing text or line color, and remember that editing the annotation in other PDF applications will produce different appearance.

void pdftron::PDF::Annots::FreeText::GetLineColor ( ColorPt color,
int &  col_comp 
)

Returns the line and border color of the FreeText Annotation.

Parameters:
color reference to ColorPt object, where results will be saved.
col_comp reference to an integer, where number of colorant components will be written.
Note:
Current implementation of this method uses a non-standard entry in the annotation dictionary and will not return meaningful results when called on annotations not created with PDFTron software.


© 2002-2010 PDFTron Systems Inc.