All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pdftron::PDF::Annots::FreeText Class Reference

#include <FreeText.h>

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

Public Types

enum  IntentName { e_FreeText, e_FreeTextCallout, e_FreeTextTypeWriter, e_Unknown }
 
- Public Types inherited from pdftron::PDF::Annots::Markup
enum  BorderEffect { e_None, e_Cloudy }
 
- Public Types inherited from pdftron::PDF::Annot
enum  Type {
  e_Text, e_Link, e_FreeText, e_Line,
  e_Square, e_Circle, e_Polygon, e_Polyline,
  e_Highlight, e_Underline, e_Squiggly, e_StrikeOut,
  e_Stamp, e_Caret, e_Ink, e_Popup,
  e_FileAttachment, e_Sound, e_Movie, e_Widget,
  e_Screen, e_PrinterMark, e_TrapNet, e_Watermark,
  e_3D, e_Redact, e_Projection, e_RichMedia,
  e_Unknown
}
 
enum  Flag {
  e_invisible, e_hidden, e_print, e_no_zoom,
  e_no_rotate, e_no_view, e_read_only, e_locked,
  e_toggle_no_view, e_locked_contents
}
 
enum  ActionTriggerEvent {
  e_action_trigger_activate = 0, e_action_trigger_annot_enter = 1, e_action_trigger_annot_exit = 2, e_action_trigger_annot_down = 3,
  e_action_trigger_annot_up = 4, e_action_trigger_annot_focus = 5, e_action_trigger_annot_blur = 6, e_action_trigger_annot_page_open = 7,
  e_action_trigger_annot_page_close = 8, e_action_trigger_annot_page_visible = 9, e_action_trigger_annot_page_invisible = 10
}
 
enum  AnnotationState { e_normal, e_rollover, e_down }
 
typedef pdftron::PDF::BorderStyle BorderStyle
 

Public Member Functions

 FreeText (SDF::Obj d=0)
 
 FreeText (const Annot &ann)
 
UString GetDefaultAppearance () const
 
void SetDefaultAppearance (const char *app_str)
 
int GetQuaddingFormat () const
 
void SetQuaddingFormat (const int format)
 
Point GetCalloutLinePoint1 () const
 
Point GetCalloutLinePoint2 () const
 
Point GetCalloutLinePoint3 () const
 
void GetCalloutLinePoints (Point &p1, Point &p2, Point &p3) const
 
void SetCalloutLinePoints (const Point &p1, const Point &p2, const Point &p3)
 
void SetCalloutLinePoints (const Point &p1, const Point &p2)
 
IntentName GetIntentName () const
 
void SetIntentName (IntentName mode=e_FreeText)
 
Line::EndingStyle GetEndingStyle () const
 
void SetEndingStyle (Line::EndingStyle style)
 
void SetEndingStyle (const char *est)
 
void SetTextColor (const ColorPt &color, int col_comp)
 
ColorPt GetTextColor ()
 
int GetTextColorCompNum ()
 
void GetTextColor (ColorPt &color, int &col_comp)
 
void SetLineColor (const ColorPt &color, int col_comp)
 
ColorPt GetLineColor ()
 
int GetLineColorCompNum ()
 
void GetLineColor (ColorPt &color, int &col_comp)
 
void SetFontName (const char *fontName)
 
void SetFontSize (double font_size)
 
double GetFontSize ()
 
- Public Member Functions inherited from pdftron::PDF::Annots::Markup
 Markup (SDF::Obj d=0)
 
 Markup (const Annot &ann)
 
UString GetTitle ()
 
void SetTitle (const UString &title)
 
void SetTitle (const char *title)
 
Popup GetPopup () const
 
void SetPopup (const Popup &ppup)
 
double GetOpacity () const
 
void SetOpacity (double op)
 
UString GetSubject () const
 
void SetSubject (const UString &contents)
 
Date GetCreationDates () const
 
void SetCreationDates (const Date &dt)
 
BorderEffect GetBorderEffect () const
 
void SetBorderEffect (BorderEffect effect=e_None)
 
double GetBorderEffectIntensity () const
 
void SetBorderEffectIntensity (double intensity=0)
 
ColorPt GetInteriorColor () const
 
int GetInteriorColorCompNum () const
 
void SetInteriorColor (const ColorPt &c, int CompNum)
 
Rect GetContentRect () const
 
void SetContentRect (const Rect &cr)
 
Rect GetPadding () const
 
void SetPadding (const Rect &rd)
 
void SetPadding (double x)
 
void RotateAppearance (double angle)
 
- Public Member Functions inherited from pdftron::PDF::Annot
 Annot (SDF::Obj d=0)
 
 Annot (const Annot &d)
 
Annotoperator= (const Annot &d)
 
bool operator== (const Annot &d)
 
bool IsValid () const
 
SDF::Obj GetSDFObj () const
 
Type GetType () const
 
Rect GetRect () const
 
Rect GetVisibleContentBox () const
 
bool IsMarkup () const
 
void SetRect (const Rect &pos)
 
Page GetPage () const
 
void SetPage (const Page &page)
 
SDF::Obj GetUniqueID () const
 
void SetUniqueID (const char *id, int id_buf_sz=0)
 
Date GetDate () const
 
void SetDate (const Date &date)
 
bool GetFlag (Flag flag) const
 
void SetFlag (Flag flag, bool value)
 
SDF::Obj GetTriggerAction (Annot::ActionTriggerEvent trigger)
 
BorderStyle GetBorderStyle () const
 
void SetBorderStyle (const BorderStyle &bs, bool oldStyleOnly=false)
 
SDF::Obj GetAppearance (AnnotationState annot_state=e_normal, const char *app_state=0)
 
void SetAppearance (SDF::Obj app_stream, AnnotationState annot_state=e_normal, const char *app_state=0)
 
void RemoveAppearance (AnnotationState annot_state=e_normal, const char *app_state=0)
 
void Flatten (class Page page)
 
const char * GetActiveAppearanceState () const
 
void SetActiveAppearanceState (const char *astate)
 
ColorPt GetColorAsRGB () const
 
ColorPt GetColorAsCMYK () const
 
ColorPt GetColorAsGray () const
 
int GetColorCompNum () const
 
void SetColor (const ColorPt &col, int numcomp=3)
 
int GetStructParent () const
 
void SetStructParent (const int parkeyval)
 
SDF::Obj GetOptionalContent () const
 
void SetOptionalContent (SDF::Obj content)
 
void SetContents (const UString &contents)
 
UString GetContents () const
 
int GetRotation () const
 
void SetRotation (int angle)
 
void RefreshAppearance ()
 
void RefreshAppearance (const RefreshOptions &options)
 
UString GetCustomData (const UString &key) const
 
void SetCustomData (const UString &key, const UString &value)
 
void DeleteCustomData (const UString &key)
 
void Resize (const Rect &newrect)
 
ptrdiff_t GetHandleInternal ()
 

Static Public Member Functions

static FreeText Create (SDF::SDFDoc &doc, const Rect &pos)
 
static FreeText CreateAnnot (SDF::SDFDoc &doc, const Rect &pos)
 
- Static Public Member Functions inherited from pdftron::PDF::Annot
static Annot Create (SDF::SDFDoc &doc, Type type, const Rect &pos)
 
static AnnotCreateInternal (ptrdiff_t impl)
 

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.

Definition at line 24 of file FreeText.h.

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.

Definition at line 161 of file FreeText.h.

Constructor & Destructor Documentation

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

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

Parameters
dThe Cos/SDF object to initialze the annotation with.
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.

Parameters
annAnnot object used to initialize the FreeText annotation.
Note
The constructor does not copy any data, but is instead the logical equivalent of a type cast.

Definition at line 41 of file FreeText.h.

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
docA document to which the FreeText annotation is added.
posA rectangle specifying the FreeText annotation's bounds in default user space units.
Returns
A newly created blank FreeText annotation.
static FreeText pdftron::PDF::Annots::FreeText::CreateAnnot ( SDF::SDFDoc doc,
const Rect pos 
)
static
Point pdftron::PDF::Annots::FreeText::GetCalloutLinePoint1 ( ) const

Returns the callout line points of the FreeText annotation. (PDF 1.6)

Parameters
p1The target point. (where the ending style is used)
p2The ending point.
p3The 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.
Point pdftron::PDF::Annots::FreeText::GetCalloutLinePoint2 ( ) const
Point pdftron::PDF::Annots::FreeText::GetCalloutLinePoint3 ( ) const
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
p1The target point. (where the ending style is used)
p2The ending point.
p3The 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.
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.
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 target point(p1) of the CallOut Line Points. Default value: e_None.
double pdftron::PDF::Annots::FreeText::GetFontSize ( )

Get the default appearance font size. To get the actual font size used, call RefreshAppearance and then use ElementReader on the content stream of this annotation.

Returns
the default font size, where a value of zero indicates auto sizing.
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".
ColorPt pdftron::PDF::Annots::FreeText::GetLineColor ( )

Returns the line and border color of the FreeText Annotation.

Parameters
colorreference to ColorPt object, where results will be saved.
col_compreference 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::GetLineColor ( ColorPt color,
int &  col_comp 
)

Returns the line and border color of the FreeText Annotation.

Parameters
colorreference to ColorPt object, where results will be saved.
col_compreference 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.
int pdftron::PDF::Annots::FreeText::GetLineColorCompNum ( )
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
ColorPt pdftron::PDF::Annots::FreeText::GetTextColor ( )

Returns the text color of the FreeText Annotation.

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::GetTextColor ( ColorPt color,
int &  col_comp 
)

Returns the text color of the FreeText Annotation.

Parameters
colorreference to ColorPt object, where results will be saved.
col_compreference 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.
int pdftron::PDF::Annots::FreeText::GetTextColorCompNum ( )
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
p1The target point. (where the ending style is used)
p2The knee point.
p3The ending 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
p1The target point. (where the ending style is used)
p2The ending point.
Note
The coordinates are defined in default user space.
void pdftron::PDF::Annots::FreeText::SetDefaultAppearance ( const char *  app_str)

Sets the default appearance of the FreeText annotation.

Parameters
app_strA 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::SetEndingStyle ( Line::EndingStyle  style)

Sets the ending style of the callout line of the FreeText Annotation. (Optional; meaningful only if CL is present; PDF 1.6)

Parameters
styleThe 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 target 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
estThe 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 target point(p1) of the CallOut Line Points. Default value: "None".
void pdftron::PDF::Annots::FreeText::SetFontName ( const char *  fontName)

Sets the default appearance font name.

Parameters
fontNameSet the default name name.
void pdftron::PDF::Annots::FreeText::SetFontSize ( double  font_size)

Sets the default appearance font size. A value of zero specifies that the font size should should adjust so that the text uses as much of the FreeText bounding box as possible.

Parameters
font_sizeSet the default font size. A value of zero means auto resize font.
void pdftron::PDF::Annots::FreeText::SetIntentName ( IntentName  mode = e_FreeText)

Sets the Intent name of the FreeText annotation. (Optional; PDF 1.4)

Parameters
modeThe intent name of the annotation as an entry from the enum "IntentName".
void pdftron::PDF::Annots::FreeText::SetLineColor ( const ColorPt color,
int  col_comp 
)

Sets the line and border color of the FreeText Annotation.

Parameters
colorColorPt object representing the color.
col_compnumber 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::SetQuaddingFormat ( const int  format)

Sets the quading format of the FreeText annotation. (Optional; PDF 1.4)

Parameters
formatA 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::SetTextColor ( const ColorPt color,
int  col_comp 
)

Sets the text color of the FreeText Annotation.

Parameters
colorColorPt object representing the color.
col_compnumber 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.

The documentation for this class was generated from the following file: