Table of Contents

Class PdfAnnotation

Namespace
iText.Kernel.Pdf.Annot
Assembly
itext.kernel.dll

This is a super class for the annotation dictionary wrappers.

public abstract class PdfAnnotation : PdfObjectWrapper<PdfDictionary>
Inheritance
PdfAnnotation
Derived
Inherited Members

Remarks

This is a super class for the annotation dictionary wrappers. Derived classes represent different standard types of annotations. See ISO-320001 12.5.6, "Annotation Types."

Constructors

PdfAnnotation(Rectangle)

protected PdfAnnotation(Rectangle rect)

Parameters

rect Rectangle

PdfAnnotation(PdfDictionary)

protected PdfAnnotation(PdfDictionary pdfObject)

Parameters

pdfObject PdfDictionary

Fields

Accepted

Annotation state.

public static readonly PdfString Accepted

Field Value

PdfString

Remarks

Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also see SetState(PdfString).

Canceled

Annotation state.

public static readonly PdfString Canceled

Field Value

PdfString

Remarks

Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also see SetState(PdfString).

Completed

Annotation state.

public static readonly PdfString Completed

Field Value

PdfString

Remarks

Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also see SetState(PdfString).

HIDDEN

Annotation flag.

public const int HIDDEN = 2

Field Value

int

Remarks

Annotation flag. See also SetFlag(int) and ISO-320001, table 165.

HIGHLIGHT_INVERT

Widget annotation highlighting mode.

public static readonly PdfName HIGHLIGHT_INVERT

Field Value

PdfName

Remarks

Widget annotation highlighting mode. See ISO-320001, Table 188 (H key). Also see SetHighlightMode(PdfName).

HIGHLIGHT_NONE

Widget annotation highlighting mode.

public static readonly PdfName HIGHLIGHT_NONE

Field Value

PdfName

Remarks

Widget annotation highlighting mode. See ISO-320001, Table 188 (H key). Also see SetHighlightMode(PdfName).

HIGHLIGHT_OUTLINE

Widget annotation highlighting mode.

public static readonly PdfName HIGHLIGHT_OUTLINE

Field Value

PdfName

Remarks

Widget annotation highlighting mode. See ISO-320001, Table 188 (H key). Also see SetHighlightMode(PdfName).

HIGHLIGHT_PUSH

Widget annotation highlighting mode.

public static readonly PdfName HIGHLIGHT_PUSH

Field Value

PdfName

Remarks

Widget annotation highlighting mode. See ISO-320001, Table 188 (H key). Also see SetHighlightMode(PdfName).

HIGHLIGHT_TOGGLE

Widget annotation highlighting mode.

public static readonly PdfName HIGHLIGHT_TOGGLE

Field Value

PdfName

Remarks

Widget annotation highlighting mode. See ISO-320001, Table 188 (H key). Also see SetHighlightMode(PdfName).

INVISIBLE

Annotation flag.

public const int INVISIBLE = 1

Field Value

int

Remarks

Annotation flag. See also SetFlag(int) and ISO-320001, table 165.

LOCKED

Annotation flag.

public const int LOCKED = 128

Field Value

int

Remarks

Annotation flag. See also SetFlag(int) and ISO-320001, table 165.

LOCKED_CONTENTS

Annotation flag.

public const int LOCKED_CONTENTS = 512

Field Value

int

Remarks

Annotation flag. See also SetFlag(int) and ISO-320001, table 165.

Marked

Annotation state.

public static readonly PdfString Marked

Field Value

PdfString

Remarks

Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also see SetState(PdfString).

MarkedModel

Annotation state model.

public static readonly PdfString MarkedModel

Field Value

PdfString

Remarks

Annotation state model. See ISO-320001, Table 172 (StateModel key). Also see SetStateModel(PdfString).

NO_ROTATE

Annotation flag.

public const int NO_ROTATE = 16

Field Value

int

Remarks

Annotation flag. See also SetFlag(int) and ISO-320001, table 165.

NO_VIEW

Annotation flag.

public const int NO_VIEW = 32

Field Value

int

Remarks

Annotation flag. See also SetFlag(int) and ISO-320001, table 165.

NO_ZOOM

Annotation flag.

public const int NO_ZOOM = 8

Field Value

int

Remarks

Annotation flag. See also SetFlag(int) and ISO-320001, table 165.

None

Annotation state.

public static readonly PdfString None

Field Value

PdfString

Remarks

Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also see SetState(PdfString).

PRINT

Annotation flag.

public const int PRINT = 4

Field Value

int

Remarks

Annotation flag. See also SetFlag(int) and ISO-320001, table 165.

READ_ONLY

Annotation flag.

public const int READ_ONLY = 64

Field Value

int

Remarks

Annotation flag. See also SetFlag(int) and ISO-320001, table 165.

Rejected

Annotation state.

public static readonly PdfString Rejected

Field Value

PdfString

Remarks

Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also see SetState(PdfString).

ReviewModel

Annotation state model.

public static readonly PdfString ReviewModel

Field Value

PdfString

Remarks

Annotation state model. See ISO-320001, Table 172 (StateModel key). Also see SetStateModel(PdfString).

STYLE_BEVELED

Annotation border style.

public static readonly PdfName STYLE_BEVELED

Field Value

PdfName

Remarks

Annotation border style. See ISO-320001, Table 166 (S key).

STYLE_DASHED

Annotation border style.

public static readonly PdfName STYLE_DASHED

Field Value

PdfName

Remarks

Annotation border style. See ISO-320001, Table 166 (S key).

STYLE_INSET

Annotation border style.

public static readonly PdfName STYLE_INSET

Field Value

PdfName

Remarks

Annotation border style. See ISO-320001, Table 166 (S key).

STYLE_SOLID

Annotation border style.

public static readonly PdfName STYLE_SOLID

Field Value

PdfName

Remarks

Annotation border style. See ISO-320001, Table 166 (S key).

STYLE_UNDERLINE

Annotation border style.

public static readonly PdfName STYLE_UNDERLINE

Field Value

PdfName

Remarks

Annotation border style. See ISO-320001, Table 166 (S key).

TOGGLE_NO_VIEW

Annotation flag.

public const int TOGGLE_NO_VIEW = 256

Field Value

int

Remarks

Annotation flag. See also SetFlag(int) and ISO-320001, table 165.

Unmarked

Annotation state.

public static readonly PdfString Unmarked

Field Value

PdfString

Remarks

Annotation state. See ISO-320001 12.5.6.3 "Annotation States" and Table 171 in particular. Also see SetState(PdfString).

page

protected PdfPage page

Field Value

PdfPage

Methods

AddAssociatedFile(PdfFileSpec)

Adds file associated with PDF annotation and identifies the relationship between them.
public virtual void AddAssociatedFile(PdfFileSpec fs)

Parameters

fs PdfFileSpec

file specification dictionary of associated file

Remarks

Adds file associated with PDF annotation and identifies the relationship between them.

Associated files may be used in Pdf/A-3 and Pdf 2.0 documents. The method adds file to array value of the AF key in the annotation dictionary.

For associated files their associated file specification dictionaries shall include the AFRelationship key

Flush()

To manually flush a PdfObject behind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference.

public override void Flush()

Remarks

To manually flush a PdfObject behind this wrapper, you have to ensure that this object is added to the document, i.e. it has an indirect reference. Basically this means that before flushing you need to explicitly call MakeIndirect(PdfDocument). For example: wrapperInstance.makeIndirect(document).flush(); Note that not every wrapper require this, only those that have such warning in documentation.

GetAppearanceDictionary()

An appearance dictionary specifying how the annotation shall be presented visually on the page during its interactions with the user (see ISO-320001 12.5.5, "Appearance Streams").

public virtual PdfDictionary GetAppearanceDictionary()

Returns

PdfDictionary

an appearance PdfDictionary or null if it is not specified.

Remarks

An appearance dictionary specifying how the annotation shall be presented visually on the page during its interactions with the user (see ISO-320001 12.5.5, "Appearance Streams"). An appearance dictionary is a dictionary containing one or several appearance streams or subdictionaries.

GetAppearanceObject(PdfName)

Specific appearance object corresponding to the specific appearance type.

public virtual PdfDictionary GetAppearanceObject(PdfName appearanceType)

Parameters

appearanceType PdfName

a PdfName specifying appearance type. Possible types are Normal , Rollover and Down.

Returns

PdfDictionary

null if their is no such appearance type or an appearance object which might be either an appearance stream or an appearance subdictionary.

Remarks

Specific appearance object corresponding to the specific appearance type. This object might be either an appearance stream or an appearance subdictionary. In the latter case, the subdictionary defines multiple appearance streams corresponding to different appearance states of the annotation. See ISO-320001 12.5.5, "Appearance Streams".

GetAppearanceState()

The annotation’s appearance state, which selects the applicable appearance stream from an appearance subdictionary if there is such.

public virtual PdfName GetAppearanceState()

Returns

PdfName

a PdfName which defines selected appearance state.

Remarks

The annotation’s appearance state, which selects the applicable appearance stream from an appearance subdictionary if there is such. See GetAppearanceObject(PdfName) for more info.

GetAssociatedFiles(bool)

Returns files associated with PDF annotation.

public virtual PdfArray GetAssociatedFiles(bool create)

Parameters

create bool

defines whether AF arrays will be created if it doesn't exist

Returns

PdfArray

associated files array

GetBlendMode()

PDF 2.0.

public virtual PdfName GetBlendMode()

Returns

PdfName

the blend mode

Remarks

PDF 2.0. The blend mode that shall be used when painting the annotation onto the page

GetBorder()

An array specifying the characteristics of the annotation’s border.

public virtual PdfArray GetBorder()

Returns

PdfArray

an PdfArray specifying the characteristics of the annotation’s border.

Remarks

An array specifying the characteristics of the annotation’s border. The array consists of three numbers defining the horizontal corner radius, vertical corner radius, and border width, all in default user space units. If the corner radii are 0, the border has square (not rounded) corners; if the border width is 0, no border is drawn.

The array may have a fourth element, an optional dash array (see ISO-320001 8.4.3.6, "Line Dash Pattern").

GetColorObject()

An array of numbers in the range 0.0 to 1.0, representing a 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
The number of array elements determines the colour space in which the colour shall be defined:
  • 0 - No colour; transparent
  • 1 - DeviceGray
  • 3 - DeviceRGB
  • 4 - DeviceCMYK
public virtual PdfArray GetColorObject()

Returns

PdfArray

An array of numbers in the range 0.0 to 1.0, representing an annotation colour.

GetContents()

Gets the text that shall be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation’s contents in human-readable form.

public virtual PdfString GetContents()

Returns

PdfString

annotation text content.

GetDate()

The date and time when the annotation was most recently modified.

public virtual PdfString GetDate()

Returns

PdfString

a PdfString with the modification date as it's value or null if date is not specified.

Remarks

The date and time when the annotation was most recently modified. This is an optional property of the annotation.

GetDownAppearanceObject()

The down appearance is used when the mouse button is pressed or held down within the annotation’s active area.

public virtual PdfDictionary GetDownAppearanceObject()

Returns

PdfDictionary

null if down appearance is not specified or an appearance object which might be either an appearance stream or an appearance subdictionary.

Remarks

The down appearance is used when the mouse button is pressed or held down within the annotation’s active area. If not specified normal appearance is used. See also GetAppearanceObject(PdfName).

GetFlags()

A set of flags specifying various characteristics of the annotation (see ISO-320001 12.5.3, "Annotation Flags").

public virtual int GetFlags()

Returns

int

an integer interpreted as one-bit flags specifying various characteristics of the annotation.

Remarks

A set of flags specifying various characteristics of the annotation (see ISO-320001 12.5.3, "Annotation Flags"). For specific annotation flag constants see SetFlag(int). Default value: 0.

GetLang()

PDF 2.0.

public virtual string GetLang()

Returns

string

the lang entry

Remarks

PDF 2.0. A language identifier overriding the document’s language identifier to specify the natural language for all text in the annotation except where overridden by other explicit language specifications

GetName()

Gets the annotation name, a text string uniquely identifying it among all the annotations on its page.

public virtual PdfString GetName()

Returns

PdfString

a PdfString with annotation name as it's value or null if name is not specified.

GetNonStrokingOpacity()

PDF 2.0.

public virtual float GetNonStrokingOpacity()

Returns

float

opacity value for nonstroking operations. Returns 1.0 (default value) if entry is not present

Remarks

PDF 2.0. When regenerating the annotation's appearance stream, this is the opacity value that shall be used for all nonstroking operations on all visible elements of the annotation in its closed state (including its background and border) but not the popup window that appears when the annotation is opened.

GetNormalAppearanceObject()

The normal appearance is used when the annotation is not interacting with the user.

public virtual PdfDictionary GetNormalAppearanceObject()

Returns

PdfDictionary

an appearance object which might be either an appearance stream or an appearance subdictionary.

Remarks

The normal appearance is used when the annotation is not interacting with the user. This appearance is also used for printing the annotation. See also GetAppearanceObject(PdfName).

GetPage()

Gets a PdfPage on which annotation is placed.

public virtual PdfPage GetPage()

Returns

PdfPage

PdfPage on which annotation is placed or null if annotation is not placed yet.

GetPageObject()

Gets a PdfDictionary that represents a page of the document on which annotation is placed, i.e. which has this annotation in it's /Annots array.

public virtual PdfDictionary GetPageObject()

Returns

PdfDictionary

PdfDictionary that is a page pdf object or null if annotation is not added to the page yet.

GetRectangle()

The annotation rectangle, defining the location of the annotation on the page in default user space units.

public virtual PdfArray GetRectangle()

Returns

PdfArray

a PdfArray which specifies a rectangle by two diagonally opposite corners. Typically, the array is of form [llx lly urx ury].

GetRolloverAppearanceObject()

The rollover appearance is used when the user moves the cursor into the annotation’s active area without pressing the mouse button.

public virtual PdfDictionary GetRolloverAppearanceObject()

Returns

PdfDictionary

null if rollover appearance is not specified or an appearance object which might be either an appearance stream or an appearance subdictionary.

Remarks

The rollover appearance is used when the user moves the cursor into the annotation’s active area without pressing the mouse button. If not specified normal appearance is used. See also GetAppearanceObject(PdfName).

GetStrokingOpacity()

PDF 2.0.

public virtual float GetStrokingOpacity()

Returns

float

opacity for stroking operations, including background and border

Remarks

PDF 2.0. When regenerating the annotation's appearance stream, this is the opacity value that shall be used for stroking all visible elements of the annotation in its closed state, including its background and border, but not the popup window that appears when the annotation is opened.

GetStructParentIndex()

The integer key of the annotation’s entry in the structural parent tree (see ISO-320001 14.7.4.4, "Finding Structure Elements from Content Items").

public virtual int GetStructParentIndex()

Returns

int

integer key in structural parent tree or -1 if annotation is not tagged.

GetSubtype()

Gets a PdfName which value is a subtype of this annotation.

public abstract PdfName GetSubtype()

Returns

PdfName

subtype of this annotation.

Remarks

Gets a PdfName which value is a subtype of this annotation. See ISO-320001 12.5.6, "Annotation Types" for the reference to the possible types.

GetTitle()

Annotation title.

public virtual PdfString GetTitle()

Returns

PdfString

PdfString which value is an annotation title or null if it isn't specified.

Remarks

Annotation title. For example for markup annotations, the title is the text label that shall be displayed in the title bar of the annotation’s pop-up window when open and active. For movie annotation Movie actions (ISO-320001 12.6.4.9, "Movie Actions") may use this title to reference the movie annotation.

HasFlag(int)

Checks if the certain flag that specifies a characteristic of the annotation is in enabled state (see ISO-320001 12.5.3, "Annotation Flags").

public virtual bool HasFlag(int flag)

Parameters

flag int

an integer interpreted as set of one-bit flags. Only one bit must be set in this integer, otherwise exception is thrown.

Returns

bool

true if the given flag is in enabled state.

Remarks

Checks if the certain flag that specifies a characteristic of the annotation is in enabled state (see ISO-320001 12.5.3, "Annotation Flags"). This method allows only one flag to be checked at once, use constants listed in SetFlag(int).

IsWrappedObjectMustBeIndirect()

protected override bool IsWrappedObjectMustBeIndirect()

Returns

bool

MakeAnnotation(PdfObject)

Factory method that creates the type specific PdfAnnotation from the given PdfObject that represents annotation object.

public static PdfAnnotation MakeAnnotation(PdfObject pdfObject)

Parameters

pdfObject PdfObject

a PdfObject that represents annotation in the document.

Returns

PdfAnnotation

created PdfAnnotation.

Remarks

Factory method that creates the type specific PdfAnnotation from the given PdfObject that represents annotation object. This method is useful for property reading in reading mode or modifying in stamping mode. See derived classes of this class to see possible specific annotation types created.

Put(PdfName, PdfObject)

Inserts the value into into the underlying PdfDictionary of this PdfAnnotation and associates it with the specified key.

public virtual PdfAnnotation Put(PdfName key, PdfObject value)

Parameters

key PdfName

key to insert or to override

value PdfObject

the value to associate with the specified key

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Inserts the value into into the underlying PdfDictionary of this PdfAnnotation and associates it with the specified key. If the key is already present in this PdfAnnotation , this method will override the old value with the specified one.

Remove(PdfName)

Removes the specified key from the underlying PdfDictionary of this PdfAnnotation.

public virtual PdfAnnotation Remove(PdfName key)

Parameters

key PdfName

key to be removed

Returns

PdfAnnotation

this PdfAnnotation instance.

ResetFlag(int)

Resets a flag that specifies a characteristic of the annotation to disabled state (see ISO-320001 12.5.3, "Annotation Flags").

public virtual PdfAnnotation ResetFlag(int flag)

Parameters

flag int

an integer interpreted as set of one-bit flags which will be reset to disabled state.

Returns

PdfAnnotation

this PdfAnnotation instance.

SetAppearance(PdfName, PdfAnnotationAppearance)

Sets a specific type of the appearance using PdfAnnotationAppearance wrapper.

public virtual PdfAnnotation SetAppearance(PdfName appearanceType, PdfAnnotationAppearance appearance)

Parameters

appearanceType PdfName

a PdfName specifying appearance type. Possible types are Normal , Rollover and Down.

appearance PdfAnnotationAppearance

an appearance subdictionary wrapped in PdfAnnotationAppearance.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets a specific type of the appearance using PdfAnnotationAppearance wrapper. This method is used to set only an appearance subdictionary. See GetAppearanceObject(PdfName) and GetAppearanceDictionary() for more info.

SetAppearance(PdfName, PdfDictionary)

Sets a specific type of the appearance.

public virtual PdfAnnotation SetAppearance(PdfName appearanceType, PdfDictionary appearance)

Parameters

appearanceType PdfName

a PdfName specifying appearance type. Possible types are Normal , Rollover and Down.

appearance PdfDictionary

an appearance object which might be either an appearance stream or an appearance subdictionary.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets a specific type of the appearance. See GetAppearanceObject(PdfName) and GetAppearanceDictionary() for more info.

SetAppearanceState(PdfName)

Sets the annotation’s appearance state, which selects the applicable appearance stream from an appearance subdictionary.

public virtual PdfAnnotation SetAppearanceState(PdfName @as)

Parameters

as PdfName

a PdfName which defines appearance state to be selected.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets the annotation’s appearance state, which selects the applicable appearance stream from an appearance subdictionary. See GetAppearanceObject(PdfName) for more info.

SetBlendMode(PdfName)

PDF 2.0.

public virtual PdfAnnotation SetBlendMode(PdfName blendMode)

Parameters

blendMode PdfName

blend mode

Returns

PdfAnnotation

this PdfAnnotation instance

Remarks

PDF 2.0. The blend mode that shall be used when painting the annotation onto the page

SetBorder(PdfAnnotationBorder)

Sets the characteristics of the annotation’s border.

public virtual PdfAnnotation SetBorder(PdfAnnotationBorder border)

Parameters

border PdfAnnotationBorder

an PdfAnnotationBorder specifying the characteristics of the annotation’s border. See GetBorder() for more detailes.

Returns

PdfAnnotation

this PdfAnnotation instance.

SetBorder(PdfArray)

Sets the characteristics of the annotation’s border.

public virtual PdfAnnotation SetBorder(PdfArray border)

Parameters

border PdfArray

an PdfArray specifying the characteristics of the annotation’s border. See GetBorder() for more detailes.

Returns

PdfAnnotation

this PdfAnnotation instance.

SetColor(float[])

Sets an annotation color.

public virtual PdfAnnotation SetColor(float[] color)

Parameters

color float[]

an array of numbers in the range 0.0 to 1.0, specifying color.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets an annotation color. For more details on annotation color purposes and the format of the passing array see GetColorObject().

SetColor(Color)

Sets an annotation color.

public virtual PdfAnnotation SetColor(Color color)

Parameters

color Color

Color object of the either DeviceGray , DeviceRgb or DeviceCmyk type.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets an annotation color. For more details on annotation color purposes see GetColorObject().

SetColor(PdfArray)

Sets an annotation color.

public virtual PdfAnnotation SetColor(PdfArray color)

Parameters

color PdfArray

an array of numbers in the range 0.0 to 1.0, specifying color.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets an annotation color. For more details on annotation color purposes and the format of the passing PdfArray see GetColorObject().

SetContents(string)

Sets the text that shall be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation’s contents in human-readable form.

public virtual PdfAnnotation SetContents(string contents)

Parameters

contents string

a java string containing text content to be set to the annotation.

Returns

PdfAnnotation

this PdfAnnotation instance.

SetContents(PdfString)

Sets the text that shall be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation’s contents in human-readable form.

public virtual PdfAnnotation SetContents(PdfString contents)

Parameters

contents PdfString

a PdfString containing text content to be set to the annotation.

Returns

PdfAnnotation

this PdfAnnotation instance.

SetDate(PdfString)

The date and time when the annotation was most recently modified.

public virtual PdfAnnotation SetDate(PdfString date)

Parameters

date PdfString

a PdfString with date. The format should be a date string as described in ISO-320001 7.9.4, "Dates".

Returns

PdfAnnotation

this PdfAnnotation instance.

SetDownAppearance(PdfAnnotationAppearance)

Sets down appearance using PdfAnnotationAppearance wrapper.

public virtual PdfAnnotation SetDownAppearance(PdfAnnotationAppearance appearance)

Parameters

appearance PdfAnnotationAppearance

an appearance subdictionary wrapped in PdfAnnotationAppearance.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets down appearance using PdfAnnotationAppearance wrapper. This method is used to set only appearance subdictionary. See GetDownAppearanceObject() and GetAppearanceDictionary() for more info.

SetDownAppearance(PdfDictionary)

Sets down appearance.

public virtual PdfAnnotation SetDownAppearance(PdfDictionary appearance)

Parameters

appearance PdfDictionary

an appearance object which might be either an appearance stream or an appearance subdictionary.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets down appearance. See GetDownAppearanceObject() and GetAppearanceDictionary() for more info.

SetFlag(int)

Sets a flag that specifies a characteristic of the annotation to enabled state (see ISO-320001 12.5.3, "Annotation Flags").

public virtual PdfAnnotation SetFlag(int flag)

Parameters

flag int
  • an integer interpreted as set of one-bit flags which will be enabled for this annotation.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets a flag that specifies a characteristic of the annotation to enabled state (see ISO-320001 12.5.3, "Annotation Flags"). On the contrary from SetFlags(int) , this method sets only specified flags to enabled state, but doesn't disable other flags. Possible flags:

  • INVISIBLE - If set, do not display the annotation if it does not belong to one of the standard annotation types and no annotation handler is available. If clear, display such unknown annotation using an appearance stream specified by its appearance dictionary, if any.
  • HIDDEN - If set, do not display or print the annotation or allow it to interact with the user, regardless of its annotation type or whether an annotation handler is available.
  • PRINT - If set, print the annotation when the page is printed. If clear, never print the annotation, regardless of whether it is displayed on the screen.
  • NO_ZOOM - If set, do not scale the annotation’s appearance to match the magnification of the page. The location of the annotation on the page (defined by the upper-left corner of its annotation rectangle) shall remain fixed, regardless of the page magnification.}
  • NO_ROTATE - If set, do not rotate the annotation’s appearance to match the rotation of the page. The upper-left corner of the annotation rectangle shall remain in a fixed location on the page, regardless of the page rotation.
  • NO_VIEW - If set, do not display the annotation on the screen or allow it to interact with the user. The annotation may be printed (depending on the setting of the Print flag) but should be considered hidden for purposes of on-screen display and user interaction.
  • READ_ONLY - If set, do not allow the annotation to interact with the user. The annotation may be displayed or printed (depending on the settings of the NoView and Print flags) but should not respond to mouse clicks or change its appearance in response to mouse motions.
  • LOCKED - If set, do not allow the annotation to be deleted or its properties (including position and size) to be modified by the user. However, this flag does not restrict changes to the annotation’s contents, such as the value of a form field.
  • TOGGLE_NO_VIEW - If set, invert the interpretation of the NoView flag for certain events.
  • LOCKED_CONTENTS - If set, do not allow the contents of the annotation to be modified by the user. This flag does not restrict deletion of the annotation or changes to other annotation properties, such as position and size.

SetFlags(int)

Sets a set of flags specifying various characteristics of the annotation (see ISO-320001 12.5.3, "Annotation Flags").

public virtual PdfAnnotation SetFlags(int flags)

Parameters

flags int

an integer interpreted as set of one-bit flags specifying various characteristics of the annotation.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets a set of flags specifying various characteristics of the annotation (see ISO-320001 12.5.3, "Annotation Flags"). On the contrary from SetFlag(int) , this method sets a complete set of enabled and disabled flags at once. If not set specifically the default value is 0.

SetLang(string)

PDF 2.0.

public virtual PdfAnnotation SetLang(string lang)

Parameters

lang string

language identifier

Returns

PdfAnnotation

this PdfAnnotation instance

Remarks

PDF 2.0. A language identifier overriding the document’s language identifier to specify the natural language for all text in the annotation except where overridden by other explicit language specifications

SetLayer(IPdfOCG)

Sets the layer this annotation belongs to.

public virtual void SetLayer(IPdfOCG layer)

Parameters

layer IPdfOCG

the layer this annotation belongs to

SetName(PdfString)

Sets the annotation name, a text string uniquely identifying it among all the annotations on its page.

public virtual PdfAnnotation SetName(PdfString name)

Parameters

name PdfString

a PdfString to be set as annotation name.

Returns

PdfAnnotation

this PdfAnnotation instance.

SetNonStrokingOpacity(float)

PDF 2.0.

public virtual PdfAnnotation SetNonStrokingOpacity(float nonStrokingOpacity)

Parameters

nonStrokingOpacity float

opacity for nonstroking operations

Returns

PdfAnnotation

this PdfAnnotation instance

Remarks

PDF 2.0. When regenerating the annotation's appearance stream, this is the opacity value that shall be used for all nonstroking operations on all visible elements of the annotation in its closed state (including its background and border) but not the popup window that appears when the annotation is opened.

SetNormalAppearance(PdfAnnotationAppearance)

Sets normal appearance using PdfAnnotationAppearance wrapper.

public virtual PdfAnnotation SetNormalAppearance(PdfAnnotationAppearance appearance)

Parameters

appearance PdfAnnotationAppearance

an appearance subdictionary wrapped in PdfAnnotationAppearance.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets normal appearance using PdfAnnotationAppearance wrapper. This method is used to set only appearance subdictionary. See GetNormalAppearanceObject() and GetAppearanceDictionary() for more info.

SetNormalAppearance(PdfDictionary)

Sets normal appearance.

public virtual PdfAnnotation SetNormalAppearance(PdfDictionary appearance)

Parameters

appearance PdfDictionary

an appearance object which might be either an appearance stream or an appearance subdictionary.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets normal appearance. See GetNormalAppearanceObject() and GetAppearanceDictionary() for more info.

SetPage(PdfPage)

Method that modifies annotation page property, which defines to which page annotation belongs.

public virtual PdfAnnotation SetPage(PdfPage page)

Parameters

page PdfPage

the PdfPage to which annotation will be added.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Method that modifies annotation page property, which defines to which page annotation belongs. Keep in mind that this doesn't actually add an annotation to the page, it should be done via AddAnnotation(PdfAnnotation). Also you don't need to set this property manually, this is done automatically on addition to the page.

SetRectangle(PdfArray)

The annotation rectangle, defining the location of the annotation on the page in default user space units.

public virtual PdfAnnotation SetRectangle(PdfArray array)

Parameters

array PdfArray

a PdfArray which specifies a rectangle by two diagonally opposite corners. Typically, the array is of form [llx lly urx ury].

Returns

PdfAnnotation

this PdfAnnotation instance.

SetRolloverAppearance(PdfAnnotationAppearance)

Sets rollover appearance using PdfAnnotationAppearance wrapper.

public virtual PdfAnnotation SetRolloverAppearance(PdfAnnotationAppearance appearance)

Parameters

appearance PdfAnnotationAppearance

an appearance subdictionary wrapped in PdfAnnotationAppearance.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets rollover appearance using PdfAnnotationAppearance wrapper. This method is used to set only appearance subdictionary. See GetRolloverAppearanceObject() and GetAppearanceDictionary() for more info.

SetRolloverAppearance(PdfDictionary)

Sets rollover appearance.

public virtual PdfAnnotation SetRolloverAppearance(PdfDictionary appearance)

Parameters

appearance PdfDictionary

an appearance object which might be either an appearance stream or an appearance subdictionary.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets rollover appearance. See GetRolloverAppearanceObject() and GetAppearanceDictionary() for more info.

SetStrokingOpacity(float)

PDF 2.0.

public virtual PdfAnnotation SetStrokingOpacity(float strokingOpacity)

Parameters

strokingOpacity float

opacity for stroking operations, including background and border

Returns

PdfAnnotation

this PdfAnnotation object

Remarks

PDF 2.0. When regenerating the annotation's appearance stream, this is the opacity value that shall be used for stroking all visible elements of the annotation in its closed state, including its background and border, but not the popup window that appears when the annotation is opened.

SetStructParentIndex(int)

Sets he integer key of the annotation’s entry in the structural parent tree (see ISO-320001 14.7.4.4, "Finding Structure Elements from Content Items").

public virtual PdfAnnotation SetStructParentIndex(int structParentIndex)

Parameters

structParentIndex int

integer which is to be the key of the annotation's entry in structural parent tree.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets he integer key of the annotation’s entry in the structural parent tree (see ISO-320001 14.7.4.4, "Finding Structure Elements from Content Items"). Note: Normally, there is no need to take care of this manually, struct parent index is set automatically if annotation is added to the tagged document's page.

SetTitle(PdfString)

Sets annotation title.

public virtual PdfAnnotation SetTitle(PdfString title)

Parameters

title PdfString

a PdfString which value is to be annotation title.

Returns

PdfAnnotation

this PdfAnnotation instance.

Remarks

Sets annotation title. This property affects not all annotation types.