Class Index

Classes


Class PDFNet.Annot

PDFNet.Annot

Class Summary
Constructor Attributes Constructor Name and Description
 
Annot is a base class for different types of annotations.
Method Summary
Method Attributes Method Name and Description
 
Compares two annotations for equality.
 
copy()
Assignment operator
<static>  
PDFNet.Annot.create(doc, type, pos)
Creates a new annotation of a given type, in the specified document.
<static>  
PDFNet.Annot.createFromObj(d)
Create an annotation and initialize it using given Cos/SDF object.
 
flatten(page)
Flatten/Merge the existing annotation appearances with the page content and delete this annotation from a given page.
 
Gets the annotation's active appearance state.
 
getAppearance(annot_state, app_state)
Gets the annotation's appearance for the given combination of annotation and appearance states.
 
Gets the border style for the annotation.
<static>  
PDFNet.Annot.getBorderStyleStyle(bs)
[Documentation Not Yet Added]
 
Gets an annotation's color without any specified color space.
 
Returns the annotation's color in CMYK color space.
 
Returns the annotation's color in Gray color space.
 
Gets an annotation's color in RGB color space.
 
Returns the color space the annotation's color is represented in.
 
Extract the content of this annotation.
 
Gets an annotation's last modified date.
 
getFlag(flag)
 
Returns optional content associated with this annotation.
 
Gets the page the annotation is associated with.
 
 
Returns the rotation value of the annotation.
 
 
Returns the struct parent of an annotation.
 
[Documentation Not Yet Added]
 
 
 
It is possible during viewing that GetRect does not return the most accurate bounding box of what is actually rendered.
 
Return true if this annotation is classified as a markup annotation.
 
 
Regenerates the appearance stream for the annotation.
 
removeAppearance(annot_state, app_state)
Removes the annotation's appearance for the given combination of annotation and appearance states.
 
resize(newrect)
Scales the geometry of the annotation so that its appearance would now fit a new rectangle on the page, in user units.
 
Sets the annotation's active appearance state.
 
setAppearance(app_stream, annot_state, app_state)
Sets the annotation's appearance for the given combination of annotation and appearance states.
 
setBorderStyle(bs, oldStyleOnly)
Sets the border style for the annotation.
<static>  
PDFNet.Annot.setBorderStyleStyle(bs, bst)
[Documentation Not Yet Added]
 
setColor(col, numcomp)
Sets an annotation's color.
 
[Documentation Not Yet Added]
 
setContents(contents)
Sets the content of this annotation.
 
setDate(date)
Sets an annotation's last modified date.
 
setFlag(flag, value)
sets the value of given Flag.
 
Associates optional content with this annotation.
 
setPage(Page)
sets the reference to a page the annotation is associated with.
 
setRect(pos)
Sets the size and location of an annotation on its page.
 
setRotation(angle)
Sets the rotation value of the annotation.
 
setStructParent(parkeyval)
sets the struct parent of an annotation.
Class Detail
PDFNet.Annot(id)
Annot is a base class for different types of annotations. For annotation specific properties, please refer to derived classes. An annotation is an interactive object placed on a page, such as a text note, a link, or an embedded file. PDF includes a wide variety of standard annotation types. An annotation associates an object such as a widget, note, or movie with a location on a page of a PDF document, or provides a means of interacting with the user via the mouse and keyboard. For more details on PDF annotations please refer to section 12.5 in the PDF Reference Manual and the documentation in derived classes.
Parameters:
id
Method Detail
{[ERROR]} compare(d)
Compares two annotations for equality. The comparison will return true only if both annotations share the same underlying SDF/Cos object.
Parameters:
{Annot} d
Annotation to compare to
Returns:
{[ERROR]} A promise that resolves to an unknown type (generated documentation)

{Annot} copy()
Assignment operator
Returns:
{Annot} A promise that resolves to an object of type: "Annot" (generated documentation)

<static> {Annot} PDFNet.Annot.create(doc, type, pos)
Creates a new annotation of a given type, in the specified document. The newly created annotation does not contain any properties specific to a given annotation type, which means an invalid annotation object could be created. It is therefore recommended to always create an annotation using type specific methods, such as Annots::Line::Create() or Annots::FileAttachment::Create(). Users should only call Annot::Create() to create annotations of non-standard types that are not recognized by PDFTron software (by using Annot::e_Unknown as a type).
Parameters:
{SDFDoc} doc
A document to which the annotation is added.
{number} type
Subtype of annotation to create.
{rect} pos
A rectangle specifying the annotation's bounds, specified in user space coordinates.
Returns:
{Annot} A promise that resolves to a newly created blank annotation for the given annotation type.

<static> {Annot} PDFNet.Annot.createFromObj(d)
Create an annotation and initialize it using given Cos/SDF object.
Parameters:
{Obj} d
The Cos/SDF object to initialze the annotation with.
Returns:
{Annot} A promise that resolves to an object of type: "Annot" (generated documentation)

flatten(page)
Flatten/Merge the existing annotation appearances with the page content and delete this annotation from a given page. Annotation 'flattening' refers to the operation that changes active annotations (such as markup, widgets, 3D models, etc.) into a static area that is part of the PDF document, just like the other text and images in the document.
Parameters:
{Page} page
(generated documentation)

{string} getActiveAppearanceState()
Gets the annotation's active appearance state.
Returns:
{string} A promise that resolves to the name of the active state. The annotation's appearance state, which selects the applicable appearance stream from an appearance subdictionary.

{Obj} getAppearance(annot_state, app_state)
Gets the annotation's appearance for the given combination of annotation and appearance states.
Parameters:
{number} annot_state
the annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance.
{string} app_state
is an optional parameter specifying the appearance state to look for (e.g. "Off", "On", etc). If appearance_state is NULL, the choice between different appearance states is determined by the AS (Appearance State) entry in the annotation dictionary.
Returns:
{Obj} A promise that resolves to the appearance stream for this annotation, or NULL if the annotation does not have an appearance for the given combination of annotation and appearance states.

{AnnotBorderStyle} getBorderStyle()
Gets the border style for the annotation. Typically used for Link annotations.
Returns:
{AnnotBorderStyle} A promise that resolves to annotation's border style.

<static> {[ERROR]} PDFNet.Annot.getBorderStyleStyle(bs)
[Documentation Not Yet Added]
Parameters:
{AnnotBorderStyle} bs
(generated documentation)
Returns:
{[ERROR]} A promise that resolves to an unknown type (generated documentation)

{colorpt} getColor()
Gets an annotation's color without any specified color space. It is generally recommended to use getColorAsRGB(), getColorAsCMYK() or getColorAsGray() for more predictable behavior
Returns:
{colorpt} A promise that resolves to a ColorPt object containing an array of numbers in the range 0.0 to 1.0.

{colorpt} getColorAsCMYK()
Returns the annotation's color in CMYK color space.
Returns:
{colorpt} A promise that resolves to a ColorPt object containing an array of four numbers in the range 0.0 to 1.0, representing a CMYK color used for the following purposes: The background of the annotation's icon when closed The title bar of the annotation's pop-up window The border of a link annotation If the annotation does not specify an explicit color, a default color is returned. Text annotations return 'default yellow;' all others return black.

{colorpt} getColorAsGray()
Returns the annotation's color in Gray color space.
Returns:
{colorpt} A promise that resolves to a ColorPt object containing a number in the range 0.0 to 1.0, representing a Gray Scale color used for the following purposes: The background of the annotation's icon when closed The title bar of the annotation's pop-up window The border of a link annotation If the annotation does not specify an explicit color, black color is returned.

{colorpt} getColorAsRGB()
Gets an annotation's color in RGB color space.
Returns:
{colorpt} A promise that resolves to a ColorPt object containing an array of three numbers in the range 0.0 to 1.0, representing an RGB colour used for the following purposes: The background of the annotation's icon when closed The title bar of the annotation's pop-up window The border of a link annotation If the annotation does not specify an explicit color, a default color is returned. Text annotations return 'default yellow;' all others return black.

{number} getColorCompNum()
Returns the color space the annotation's color is represented in.
Returns:
{number} A promise that resolves to an integer that is either 1(for DeviceGray), 3(DeviceRGB), or 4(DeviceCMYK). If the annotation has no color, i.e. is transparent, 0 will be returned.

{string} getContents()
Extract the content of this annotation. (Optional).
Returns:
{string} A promise that resolves to A unicode string object with the text that is associated with this annotation. This is the text that annotation displays on user interaction, if the annotation type supports it.

{date} getDate()
Gets an annotation's last modified date.
Returns:
{date} A promise that resolves to the annotation's last modified time and date. If the annotation has no associated date structure, the returned date is not valid (date.IsValid() returns false). Corresponds to the "M" entry of the annotation dictionary.

{boolean} getFlag(flag)
Parameters:
{number} flag
The Flag property to query.
Returns:
{boolean} A promise that resolves to the value of given Flag

{Obj} getOptionalContent()
Returns optional content associated with this annotation.
Returns:
{Obj} A promise that resolves to a SDF object corresponding to the group of optional properties.

{Page} getPage()
Gets the page the annotation is associated with.
Returns:
{Page} A promise that resolves to a Page object or null page object if the page reference is not available. The page object returned is an indirect reference to the page object with which this annotation is associated. This entry shall be present in screen annotations associated with rendition actions. Optional. PDF 1.3 PDF 1.4 PDF 1.5 not used in FDF files.

{rect} getRect()
Returns:
{rect} A promise that resolves to annotation's bounding rectangle, specified in user space coordinates. The meaning of the rectangle depends on the annotation type. For Link and RubberStamp annotations, the rectangle specifies the area containing the hyperlink area or stamp. For Note annotations, the rectangle is describing the popup window when it's opened. When it's closed, the icon is positioned at lower left corner.

{number} getRotation()
Returns the rotation value of the annotation. The Rotation specifies the number of degrees by which the annotation shall be rotated counterclockwise relative to the page. The value shall be a multiple of 90.
Returns:
{number} A promise that resolves to an integer representing the rotation value of the annotation.

{Obj} getSDFObj()
Returns:
{Obj} A promise that resolves to the underlying SDF/Cos object.

{number} getStructParent()
Returns the struct parent of an annotation. (Required if the annotation is a structural content item; PDF 1.3)
Returns:
{number} A promise that resolves to an integer which is the integer key of the annotation's entry in the structural parent tree.

{Obj} getTriggerAction(trigger)
[Documentation Not Yet Added]
Parameters:
{number/enum} trigger
(generated enum documentation)
PDFNet.Annot.EventType = {
	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
}
Returns:
{Obj} A promise that resolves to an object of type: "Obj" (generated documentation)

{number} getType()
Return value enum:
PDFNet.Annot.Type = {
	e_Text : 0
	e_Link : 1
	e_FreeText : 2
	e_Line : 3
	e_Square : 4
	e_Circle : 5
	e_Polygon : 6
	e_Polyline : 7
	e_Highlight : 8
	e_Underline : 9
	e_Squiggly : 10
	e_StrikeOut : 11
	e_Stamp : 12
	e_Caret : 13
	e_Ink : 14
	e_Popup : 15
	e_FileAttachment : 16
	e_Sound : 17
	e_Movie : 18
	e_Widget : 19
	e_Screen : 20
	e_PrinterMark : 21
	e_TrapNet : 22
	e_Watermark : 23
	e_3D : 24
	e_Redact : 25
	e_Projection : 26
	e_RichMedia : 27
	e_Unknown : 28
}
Returns:
{number} A promise that resolves to the type of this annotation. Corresponds to the "Subtype" entry of annotation dictionary, as per PDF Reference Manual section 12.5.2

{Obj} getUniqueID()
Returns:
{Obj} A promise that resolves to the unique identifier for this annotation, or NULL if the identifier is not available. The returned value is a String object and is the value of the "NM" field, which was added as an optional attribute in PDF 1.4.

{rect} getVisibleContentBox()
It is possible during viewing that GetRect does not return the most accurate bounding box of what is actually rendered. This method calculates the bounding box, rather than relying on what is specified in the PDF document. The bounding box is defined as the smallest rectangle that includes all the visible content on the annotation.
Returns:
{rect} A promise that resolves to the bounding box for this annotation. The dimensions are specified in user space coordinates.

{boolean} isMarkup()
Return true if this annotation is classified as a markup annotation.
Returns:
{boolean} A promise that resolves to boolean value, true if this annotation is classified as a markup annotation.

{boolean} isValid()
Returns:
{boolean} A promise that resolves to true if this is a valid (non-null) annotation, false otherwise. If the function returns false the underlying SDF/Cos object is null or is not valid and the annotation object should be treated as a null object.

refreshAppearance()
Regenerates the appearance stream for the annotation. This method can be used to auto-generate the annotation appearance after creating or modifying the annotation without providing an explicit appearance or setting the "NeedAppearances" flag in the AcroForm dictionary.

removeAppearance(annot_state, app_state)
Removes the annotation's appearance for the given combination of annotation and appearance states.
Parameters:
{number} annot_state
the annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance.
{string} app_state
is an optional parameter specifying the appearance state (e.g. "Off", "On", etc) under which the new appearance should be stored. If appearance_state is NULL, the annotation will have only one annotation state.

resize(newrect)
Scales the geometry of the annotation so that its appearance would now fit a new rectangle on the page, in user units. Users still have to call RefreshAppearance() later if they want a corresponding appearance stream to be generated for the new rectangle. The main reason for not combining the two operations together is to be able to resize annotations that do not have an appearance stream.
Parameters:
{rect} newrect
A reference to the new rectangle to which this annotation has to be resized.

setActiveAppearanceState(astate)
Sets the annotation's active appearance state. (Required if the appearance dictionary AP contains one or more subdictionaries; PDF 1.2)
Parameters:
{string} astate
(generated documentation)

setAppearance(app_stream, annot_state, app_state)
Sets the annotation's appearance for the given combination of annotation and appearance states. (Optional; PDF 1.2)
Parameters:
{Obj} app_stream
a content stream defining the new appearance.
{number} annot_state
the annotation's appearance state, which selects the applicable appearance stream from the appearance sub-dictionary. An annotation can define as many as three separate appearances: The normal, rollover, and down appearance.
{string} app_state
is an optional parameter specifying the appearance state (e.g. "Off", "On", etc) under which the new appearance should be stored. If appearance_state is NULL, the annotation will have only one annotation state.

setBorderStyle(bs, oldStyleOnly)
Sets the border style for the annotation.
Parameters:
{AnnotBorderStyle} bs
New border style for this annotation.
{boolean} oldStyleOnly
PDF manual specifies two ways to add border information to an annotation object, either through an array named 'Border' (PDF 1.0), or a dictionary called 'BS' (PDF 1.2) the latter taking precedence over the former. However, if you want to create a border with rounded corners, you can only do that using PDF 1.0 Border specification, in which case if you call SetBorderStyle() set the parameter oldStyleOnly to true. This parameter has a default value of false in the API and does not need to be used otherwise.

<static> PDFNet.Annot.setBorderStyleStyle(bs, bst)
[Documentation Not Yet Added]
Parameters:
{AnnotBorderStyle} bs
(generated documentation)
{number} bst
(generated documentation)

setColor(col, numcomp)
Sets an annotation's color. (Optional; PDF 1.1)
Parameters:
{colorpt} col
A ColorPt object in RGB or Gray or CMYK color space representing the annotation's color. The ColorPt contains an array of numbers in the range 0.0 to 1.0, representing a color used for the following purposes: The background of the annotation's icon when closed The title bar of the annotation's pop-up window The border of a link annotation The number of array elements determines the color space in which the color shall be defined: 0 No color; transparent 1 DeviceGray 3 DeviceRGB 4 DeviceCMYK
{number} numcomp
The number of color components used to represent the color (i.e. 1, 3, 4).

setColorDefault(col)
[Documentation Not Yet Added]
Parameters:
{colorpt} col
(generated documentation)

setContents(contents)
Sets the content of this annotation. (Optional).
Parameters:
{string} contents
A reference to unicode string object with the text that will be associated with this annotation. This is the text that annotation displays on user interaction, if the annotation type supports it.

setDate(date)
Sets an annotation's last modified date.
Parameters:
{date} date
The annotation's last modified time and date. Corresponds to the "M" entry of the annotation dictionary.

setFlag(flag, value)
sets the value of given Flag.
Parameters:
{number} flag
The Flag property to modify.
{boolean} value
The new value for the property.

setOptionalContent(content)
Associates optional content with this annotation. (Optional, PDF1.5).
Parameters:
{Obj} content
A pointer to an SDF object corresponding to the optional content, a PDF::OCG::Group or membership dictionary specifying the PDF::OCG::Group properties for the annotation. Before the annotation is drawn, its visibility shall be determined based on this entry as well as the annotation flags specified in the Flag entry . If it is determined to be invisible, the annotation shall be skipped, as if it were not in the document.

setPage(Page)
sets the reference to a page the annotation is associated with. (Optional PDF 1.3; not used in FDF files)
Parameters:
{Page} Page
The page object user wants the annotation to be associated with.

setRect(pos)
Sets the size and location of an annotation on its page.
Parameters:
{rect} pos
Annotation's bounding rectangle, specified in user space coordinates. The meaning of the rectangle depends on the annotation type. For Link and RubberStamp annotations, the rectangle specifies the area containing the hyperlink area or stamp. For Note annotations, the rectangle is describing the popup window when it's opened. When it's closed, the icon is positioned at lower left corner.

setRotation(angle)
Sets the rotation value of the annotation. The Rotation specifies the number of degrees by which the annotation shall be rotated counterclockwise relative to the page. The value shall be a multiple of 90. (Optional)
Parameters:
{number} angle
An integer representing the rotation value of the annotation.

setStructParent(parkeyval)
sets the struct parent of an annotation. (Required if the annotation is a structural content item; PDF 1.3)
Parameters:
{number} parkeyval
An integer which is the integer key of the annotation's entry in the structural parent tree.

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Sep 09 2016 14:32:38 GMT-0700 (PDT)