PTFreeText
@interface PTFreeText : PTMarkup
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.
-
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.Parameters
d
The Cos/SDF object to initialze the annotation with.
-
Undocumented
Declaration
Objective-C
- (instancetype)init;
Swift
init!()
-
Creates a new FreeText annotation in the specified document.
Declaration
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.
Return Value
A newly created blank FreeText annotation.
-
Returns the default appearance of the FreeText 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.Note
this method corresponds to the ‘DA’ entry in the annotation dictionary.Declaration
Objective-C
- (NSString *)GetDefaultAppearance;
Swift
func getDefaultAppearance() -> String!
Return Value
A string representing the default appearance of the annotation.
-
Sets the default appearance of the FreeText 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.Note
this method corresponds to the ‘DA’ entry in the annotation dictionary.Declaration
Objective-C
- (void)SetDefaultAppearance:(NSString *)app_str;
Swift
func setDefaultAppearance(_ app_str: String!)
Parameters
app_str
A string representing the default appearance of the annotation.
-
Returns the quading format of the FreeText annotation. (PDF 1.4)
Note
The following are the quading formats corresponding to each int code. 0 Left-justified 1 Centered 2 Right-justifiedDeclaration
Objective-C
- (int)GetQuaddingFormat;
Swift
func getQuaddingFormat() -> Int32
Return Value
A int (code) indicating the quading format of the FreeText annotation.
-
Sets the quading format of the FreeText annotation. (Optional; PDF 1.4)
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-justifiedDeclaration
Objective-C
- (void)SetQuaddingFormat:(int)format;
Swift
func setQuaddingFormat(_ format: Int32)
Parameters
format
A int code indicating the quading format of the FreeText annotation. Default value: 0 (left-justified).
-
Returns the callout line points of the FreeText annotation. (PDF 1.6)
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.Declaration
Objective-C
- (PTPDFPoint *)GetCalloutLinePoint1;
Swift
func getCalloutLinePoint1() -> PTPDFPoint!
Parameters
p1
The target point. (where the ending style is used)
p2
The ending point.
p3
The knee point.
Return Value
Three point objects if the line is bent or two point objects if the line is straight.
-
Undocumented
Declaration
Objective-C
- (PTPDFPoint*)GetCalloutLinePoint2;
Swift
func getCalloutLinePoint2() -> PTPDFPoint!
-
Undocumented
Declaration
Objective-C
- (PTPDFPoint*)GetCalloutLinePoint3;
Swift
func getCalloutLinePoint3() -> PTPDFPoint!
-
Sets the callout line points of the FreeText annotation. (Optional; meaningful only if IT is FreeTextCallout; PDF 1.6)
Note
The coordinates are defined in default user space.Declaration
Objective-C
- (void)SetCalloutLinePointsWithKneePoint:(PTPDFPoint *)p1 p2:(PTPDFPoint *)p2 p3:(PTPDFPoint *)p3;
Swift
func setCalloutLinePoints(withKneePoint p1: PTPDFPoint!, p2: PTPDFPoint!, p3: PTPDFPoint!)
Parameters
p1
The target point. (where the ending style is used)
p2
The knee point.
p3
The ending point.
-
Sets the callout line points of the FreeText annotation. (Optional; meaningful only if IT is FreeTextCallout; PDF 1.6)
Note
The coordinates are defined in default user space.Declaration
Objective-C
- (void)SetCalloutLinePoints:(PTPDFPoint *)p1 p2:(PTPDFPoint *)p2;
Swift
func setCalloutLinePoints(_ p1: PTPDFPoint!, p2: PTPDFPoint!)
Parameters
p1
The target point. (where the ending style is used)
p2
The ending point.
-
Returns Intent name of the FreeText annotation. (PDF 1.4)
@returns The intent name of the annotation as an entry from the enum “IntentName”.
-
Sets the Intent name of the FreeText annotation. (Optional; PDF 1.4)
Declaration
Objective-C
- (void)SetIntentName:(PTIntentName)mode;
Swift
func setIntentName(_ mode: PTIntentName)
Parameters
mode
The intent name of the annotation as an entry from the enum “IntentName”.
-
Returns the ending style of the callout line of the FreeText Annotation.
Note
The ending style specifies the line ending style that shall be used in drawing the callout line specified in CallOut LineAnnot Points (CL). The enum entry shall specify the line ending style for the endpoint defined by the target point(p1) of the CallOut LineAnnot Points. Default value: e_None.Declaration
Objective-C
- (PTEndingStyle)GetEndingStyle;
Swift
func getEndingStyle() -> PTEndingStyle
Return Value
The ending style represented as one of the entries of the enum “EndingStyle”
-
Sets the ending style of the callout line of the FreeText Annotation. (Optional; meaningful only if CL is present; PDF 1.6)
Note
The ending style specifies the line ending style that shall be used in drawing the callout line specified in CallOut LineAnnot Points (CL). The enum entry shall specify the line ending style for the endpoint defined by the target point(p1) of the CallOut LineAnnot Points. Default value: e_None.Declaration
Objective-C
- (void)SetEndingStyle:(PTEndingStyle)style;
Swift
func setEndingStyle(_ style: PTEndingStyle)
Parameters
style
The ending style represented using one of the entries of the enum “EndingStyle”
-
Sets the ending style of the callout line of the FreeText Annotation. (Optional; meaningful only if CL is present; PDF 1.6)
Note
The ending style specifies the line ending style that shall be used in drawing the callout line specified in CallOut LineAnnot Points (CL). The enum entry shall specify the line ending style for the endpoint defined by the target point(p1) of the CallOut LineAnnot Points. Default value: “None”.Declaration
Objective-C
- (void)SetEndingStyleWithString:(NSString *)est;
Swift
func setEndingStyle(with est: String!)
Parameters
est
The ending style represented using a string.
-
Sets the text color of the FreeText Annotation.
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.
Declaration
Objective-C
- (void)SetTextColor:(PTColorPt *)color col_comp:(int)col_comp;
Swift
func setTextColor(_ color: PTColorPt!, col_comp: Int32)
Parameters
color
ColorPt object representing the color.
col_comp
number of colorant components in ColorPt object.
-
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.
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.
-
Undocumented
Declaration
Objective-C
- (int)GetTextColorCompNum;
Swift
func getColorCompNum() -> Int32
-
Sets the line and border color of the FreeText Annotation.
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.
Declaration
Objective-C
- (void)SetLineColor:(PTColorPt *)color col_comp:(int)col_comp;
Swift
func setLineColor(_ color: PTColorPt!, col_comp: Int32)
Parameters
color
ColorPt object representing the color.
col_comp
number of colorant components in ColorPt object.
-
Returns the line and border 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.
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.
-
Undocumented
Declaration
Objective-C
- (int)GetLineColorCompNum;
Swift
func getLineColorCompNum() -> Int32
-
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.
Declaration
Objective-C
- (void)SetFontSize:(double)font_size;
Swift
func setFontSize(_ font_size: Double)
Parameters
font_size
Set the default font size. A value of zero means auto resize font.
-
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.
Declaration
Objective-C
- (double)GetFontSize;
Swift
func getFontSize() -> Double