new FreeTextAnnot()
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.
Methods
-
<static> create(doc, pos)
-
Creates a new FreeText annotation in the specified document.
Parameters:
Name Type Description doc
PDFNet.SDFDoc A document to which the FreeText annotation is added.
pos
PDFNet.Rect A rectangle specifying the FreeText annotation's bounds in default user space units.
Returns:
A promise that resolves to a newly created blank FreeText annotation.
- Type
- PDFNet.FreeTextAnnot
-
<static> createFromAnnot(ann)
-
creates a FreeText annotation and initializes it using given annotation object.
Parameters:
Name Type Description ann
PDFNet.Annot Annot object used to initialize the FreeText annotation.
Returns:
A promise that resolves to an object of type: "FreeTextAnnot"
- Type
- PDFNet.FreeTextAnnot
-
<static> createFromObj(d)
-
creates a FreeText annotation and initializes it using given Cos/SDF object.
Parameters:
Name Type Description d
PDFNet.Obj The Cos/SDF object to initialze the annotation with.
Returns:
A promise that resolves to an object of type: "FreeTextAnnot"
- Type
- PDFNet.FreeTextAnnot
-
getCalloutLinePoints(p1, p2, p3)
-
Parameters:
Name Type Description p1
PDFNet.Point p2
PDFNet.Point p3
PDFNet.Point -
getDefaultAppearance()
-
Returns the default appearance of the FreeText annotation.
Returns:
A promise that resolves to a string representing the default appearance of the annotation.
- Type
- string
-
getEndingStyle()
-
Returns the ending style of the callout line of the FreeText Annotation.
Returns:
A promise that resolves to the ending style represented as one of the entries of the enum "EndingStyle"
- Type
- number
Example
Return value enum: <pre> PDFNet.LineAnnot.EndingStyle = { e_Square : 0 e_Circle : 1 e_Diamond : 2 e_OpenArrow : 3 e_ClosedArrow : 4 e_Butt : 5 e_ROpenArrow : 6 e_RClosedArrow : 7 e_Slash : 8 e_None : 9 e_Unknown : 10 } </pre>
-
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:
A promise that resolves tos the default font size, where a value of zero indicates auto sizing.
- Type
- number
-
getIntentName()
-
Returns Intent name of the FreeText annotation. (PDF 1.4)
Returns:
A promise that resolves tos The intent name of the annotation as an entry from the enum "IntentName".
- Type
- number
Example
Return value enum: <pre> PDFNet.FreeTextAnnot.IntentName = { e_FreeText : 0 e_FreeTextCallout : 1 e_FreeTextTypeWriter : 2 e_Unknown : 3 } </pre>
-
getLineColor(col_comp)
-
Parameters:
Name Type Description col_comp
PDFNet.ColorPt -
getQuaddingFormat()
-
Returns the quading format of the FreeText annotation. (PDF 1.4)
Returns:
A promise that resolves to a int (code) indicating the quading format of the FreeText annotation.
- Type
- number
-
getTextColor(col_comp)
-
Parameters:
Name Type Description col_comp
PDFNet.ColorPt -
setCalloutLinePoints(p1, p2, p3)
-
sets the callout line points of the FreeText annotation. (Optional; meaningful only if IT is FreeTextCallout; PDF 1.6)
Parameters:
Name Type Description p1
point The starting point.
p2
point The ending point.
p3
point The knee point.
-
setCalloutLinePointsTwo(p1, p2)
-
sets the callout line points of the FreeText annotation. (Optional; meaningful only if IT is FreeTextCallout; PDF 1.6)
Parameters:
Name Type Description p1
point The staring point.
p2
point The ending point.
-
setDefaultAppearance(app_str)
-
sets the default appearance of the FreeText annotation.
Parameters:
Name Type Description app_str
string A string representing the default appearance of the annotation.
-
setEndingStyle(style)
-
Sets the ending style of the callout line of the FreeText Annotation. (Optional; meaningful only if CL is present; PDF 1.6)
Parameters:
Name Type Description style
number The ending style represented using one of the entries of the enum "EndingStyle"
-
setEndingStyleName(est)
-
sets the ending style of the callout line of the FreeText Annotation. (Optional; meaningful only if CL is present; PDF 1.6)
Parameters:
Name Type Description est
string The ending style represented using a string.
-
setFontSize(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:
Name Type Description font_size
number Set the default font size. A value of zero means auto resize font.
-
setIntentName(mode)
-
Sets the Intent name of the FreeText annotation. (Optional; PDF 1.4)
Parameters:
Name Type Description mode
number The intent name of the annotation as an entry from the enum "IntentName".
-
setIntentNameDefault()
-
-
setLineColor(color, col_comp)
-
sets the line and border color of the FreeText Annotation.
Parameters:
Name Type Description color
PDFNet.ColorPt ColorPt object representing the color.
col_comp
number number of colorant components in ColorPt object.
-
setQuaddingFormat(format)
-
Sets the quading format of the FreeText annotation. (Optional; PDF 1.4)
Parameters:
Name Type Description format
number A int code indicating the quading format of the FreeText annotation. Default value: 0 (left-justified).
-
setTextColor(color, col_comp)
-
sets the text color of the FreeText Annotation.
Parameters:
Name Type Description color
PDFNet.ColorPt ColorPt object representing the color.
col_comp
number number of colorant components in ColorPt object.