PTAnnot

@interface PTAnnot : NSObject

Return true if this annotation is classified as a markup annotation.

  • Undocumented

    Declaration

    Objective-C

    + (PTAnnot*)Create: (PTSDFDoc*)doc type:  (PTAnnotType)type pos:  (PTPDFRect*)pos;

    Swift

    class func create(_ doc: PTSDFDoc!, type: PTAnnotType, pos: PTPDFRect!) -> PTAnnot!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)isEqualTo: (PTAnnot*)d;

    Swift

    func isEqual(to d: PTAnnot!) -> Bool
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)IsValid;

    Swift

    func isValid() -> Bool
  • Undocumented

    Declaration

    Objective-C

    - (PTObj*)GetSDFObj;

    Swift

    func getSDFObj() -> PTObj!
  • Undocumented

    Declaration

    Objective-C

    - (PTAnnotType)GetType;

    Swift

    func getType() -> PTAnnotType
  • Undocumented

    Declaration

    Objective-C

    - (PTPDFRect*)GetRect;

    Swift

    func getRect() -> PTPDFRect!
  • Undocumented

    Declaration

    Objective-C

    - (PTPDFRect*)GetVisibleContentBox;

    Swift

    func getVisibleContentBox() -> PTPDFRect!
  • Undocumented

    Declaration

    Objective-C

    - (BOOL)IsMarkup;

    Swift

    func isMarkup() -> Bool
  • Sets the size and location of an annotation on its page.

    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.

    Declaration

    Objective-C

    - (void)SetRect:(PTPDFRect *)pos;

    Swift

    func setRect(_ pos: PTPDFRect!)

    Parameters

    pos

    Annotation’s bounding rectangle, specified in user space coordinates.

  • Gets the page the annotation is associated with.

    Optional. PDF 1.3 PDF 1.4 PDF 1.5 not used in FDF files.

    Declaration

    Objective-C

    - (PTPage *)GetPage;

    Swift

    func getPage() -> PTPage!

    Return Value

    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.

  • Sets the reference to a page the annotation is associated with. (Optional PDF 1.3; not used in FDF files)

    Note

    The parameter should be 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

    Declaration

    Objective-C

    - (void)SetPage:(PTPage *)page;

    Swift

    func setPage(_ page: PTPage!)

    Parameters

    Page

    The page object user wants the annotation to be associated with.

  • Declaration

    Objective-C

    - (PTObj *)GetUniqueID;

    Swift

    func getUniqueID() -> PTObj!

    Return Value

    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.

  • Sets the unique identifier for this annotation.

    Note

    It is necessary to ensure that the unique ID generated is actually unique.

    Declaration

    Objective-C

    - (void)SetUniqueID:(NSString *)id id_buf_sz:(int)id_buf_sz;

    Swift

    func setUniqueID(_ id: String!, id_buf_sz: Int32)

    Parameters

    id

    A buffer containing a unique identifier for this annotation.

    id_buf_sz

    The size of ‘id’ buffer, or 0 if the string is NULL terminated.

  • Gets an annotation’s last modified date.

    Declaration

    Objective-C

    - (PTDate *)GetDate;

    Swift

    func getDate() -> PTDate!

    Return Value

    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.

  • Sets an annotation’s last modified date.

    Declaration

    Objective-C

    - (void)SetDate:(PTDate *)date;

    Swift

    func setDate(_ date: PTDate!)

    Parameters

    date

    The annotation’s last modified time and date. Corresponds to the M entry of the annotation dictionary.

  • Declaration

    Objective-C

    - (BOOL)GetFlag:(PTAnnotFlag)flag;

    Swift

    func getFlag(_ flag: PTAnnotFlag) -> Bool

    Parameters

    flag

    The Flag property to query.

    Return Value

    The value of given Flag

  • Sets the value of given Flag.

    Declaration

    Objective-C

    - (void)SetFlag:(PTAnnotFlag)flag value:(BOOL)value;

    Swift

    func setFlag(_ flag: PTAnnotFlag, value: Bool)

    Parameters

    flag

    The Flag property to modify.

    value

    The new value for the property.

  • Get the Action associated with the selected Annot Trigger event.

    Declaration

    Objective-C

    - (PTObj *)GetTriggerAction:(PTAnnotActionTriggerEvent)trigger;

    Swift

    func getTriggerAction(_ trigger: PTAnnotActionTriggerEvent) -> PTObj!

    Parameters

    trigger

    the type of trigger event to get

    Return Value

    the Action Obj if present, otherwise NULL

  • Gets the border style for the annotation. Typically used for Link annotations.

    Declaration

    Objective-C

    - (PTBorderStyle *)GetBorderStyle;

    Swift

    func getBorderStyle() -> PTBorderStyle!

    Return Value

    Annotation’s border style.

  • Sets the border style for the annotation.

    Declaration

    Objective-C

    - (void)SetBorderStyle:(PTBorderStyle *)bs oldStyleOnly:(BOOL)oldStyleOnly;

    Swift

    func setBorderStyle(_ bs: PTBorderStyle!, oldStyleOnly: Bool)

    Parameters

    bs

    New border style for this annotation.

    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.

  • Gets the annotation’s appearance for the given combination of annotation and appearance states.

    Declaration

    Objective-C

    - (PTObj *)GetAppearance:(PTAnnotationState)annot_state
                   app_state:(NSString *)app_state;

    Swift

    func getAppearance(_ annot_state: PTAnnotationState, app_state: String!) -> PTObj!

    Parameters

    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.

    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.

    Return Value

    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.

  • Sets the annotation’s appearance for the given combination of annotation and appearance states. (Optional; PDF 1.2)

    Declaration

    Objective-C

    - (void)SetAppearance:(PTObj *)app_stream
              annot_state:(PTAnnotationState)annot_state
                app_state:(NSString *)app_state;

    Swift

    func setAppearance(_ app_stream: PTObj!, annot_state: PTAnnotationState, app_state: String!)

    Parameters

    app_stream

    a content stream defining the new appearance.

    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.

    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.

  • Removes the annotation’s appearance for the given combination of annotation and appearance states.

    Declaration

    Objective-C

    - (void)RemoveAppearance:(PTAnnotationState)annot_state
                   app_state:(NSString *)app_state;

    Swift

    func removeAppearance(_ annot_state: PTAnnotationState, app_state: String!)

    Parameters

    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.

    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.

  • 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.

    Note

    an alternative approach to set the annotation as read only is using Annot.SetFlag(Annot::e_read_only, true) method. Unlike Annot.SetFlag(…), the result of Flatten() operation can not be programatically reversed.

    Declaration

    Objective-C

    - (void)Flatten:(PTPage *)page;

    Swift

    func flatten(_ page: PTPage!)
  • Gets the annotation’s active appearance state.

    Declaration

    Objective-C

    - (NSString *)GetActiveAppearanceState;

    Swift

    func getActiveAppearanceState() -> String!

    Return Value

    the name of the active state. The annotation’s appearance state, which selects the applicable appearance stream from an appearance subdictionary.

  • Sets the annotation’s active appearance state. (Required if the appearance dictionary AP contains one or more subdictionaries; PDF 1.2)

    @param: astate Character string representing the name of the active appearance state. The string used to select the annotation’s appearance state, which selects the applicable appearance stream from an appearance subdictionary.

    Declaration

    Objective-C

    - (void)SetActiveAppearanceState:(NSString *)astate;

    Swift

    func setActiveAppearanceState(_ astate: String!)
  • Gets an annotation’s color in RGB color space.

    If the annotation does not specify an explicit color, a default color is returned. Text annotations return ‘default yellow;’ all others return black.

    Declaration

    Objective-C

    - (PTColorPt *)GetColorAsRGB;

    Swift

    func getColorAsRGB() -> PTColorPt!

    Return Value

    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

  • Returns the annotation’s color in CMYK color space.

    If the annotation does not specify an explicit color, a default color is returned. Text annotations return ‘default yellow;’ all others return black.

    Declaration

    Objective-C

    - (PTColorPt *)GetColorAsCMYK;

    Swift

    func getColorAsCMYK() -> PTColorPt!

    Return Value

    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

  • Returns the annotation’s color in Gray color space.

    Declaration

    Objective-C

    - (PTColorPt *)GetColorAsGray;

    Swift

    func getColorAsGray() -> PTColorPt!

    Return Value

    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.

  • Returns the color space the annotation’s color is represented in.

    Declaration

    Objective-C

    - (int)GetColorCompNum;

    Swift

    func getColorCompNum() -> Int32

    Return Value

    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.

  • Sets an annotation’s color. (Optional; PDF 1.1)

    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

    Declaration

    Objective-C

    - (void)SetColor:(PTColorPt *)col numcomp:(int)numcomp;

    Swift

    func setColor(_ col: PTColorPt!, numcomp: Int32)

    Parameters

    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

    numcomp

    - The number of color components used to represent the color (i.e. 1, 3, 4).

  • Returns the struct parent of an annotation. (Required if the annotation is a structural content item; PDF 1.3)

    Note

    The StructParent is the integer key of the annotation’s entry in the structural parent tree.

    Declaration

    Objective-C

    - (int)GetStructParent;

    Swift

    func getStructParent() -> Int32

    Return Value

    An integer which is the integer key of the annotation’s entry in the structural parent tree.

  • Sets the struct parent of an annotation. (Required if the annotation is a structural content item; PDF 1.3)

    Note

    The StructParent is the integer key of the annotation’s entry in the structural parent tree.

    Declaration

    Objective-C

    - (void)SetStructParent:(int)parkeyval;

    Swift

    func setStructParent(_ parkeyval: Int32)

    Parameters

    parkeyval

    An integer which is the integer key of the annotation’s entry in the structural parent tree.

  • Returns optional content associated with this annotation.

    Note

    The return value is an Optional Content Group (OCG) or Optional Content Membership Dictionary (PDF::OCG::OCMD) specifying the optional content 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.

    Declaration

    Objective-C

    - (PTObj *)GetOptionalContent;

    Swift

    func getOptionalContent() -> PTObj!

    Return Value

    A SDF object corresponding to the group of optional properties.

  • Associates optional content with this annotation. (Optional, PDF1.5).

    Declaration

    Objective-C

    - (void)SetOptionalContent:(PTObj *)content;

    Swift

    func setOptionalContent(_ content: PTObj!)

    Parameters

    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.

  • Sets the content of this annotation. (Optional).

    Declaration

    Objective-C

    - (void)SetContents:(NSString *)contents;

    Swift

    func setContents(_ contents: String!)

    Parameters

    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.

  • Extract the content of this annotation. (Optional).

    Declaration

    Objective-C

    - (NSString *)GetContents;

    Swift

    func getContents() -> String!

    Return Value

    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.

  • 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.

    Note

    This property is part of the appearance characteristics dictionary, this dictionary that shall be used in constructing a dynamic appearance stream specifying the annotations visual presentation on the page.

    Declaration

    Objective-C

    - (int)GetRotation;

    Swift

    func getRotation() -> Int32

    Return Value

    An integer representing the rotation value of the annotation.

  • 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)

    Note

    This property is part of the appearance characteristics dictionary, this dictionary that shall be used in constructing a dynamic appearance stream specifying the annotations visual presentation on the page.

    Declaration

    Objective-C

    - (void)SetRotation:(int)angle;

    Swift

    func setRotation(_ angle: Int32)

    Parameters

    angle

    An integer representing the rotation value of the annotation.

  • 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.

    Note

    If this annotation contains text, and has been added to a rotated page, the text in the annotation may be rotated. If RefreshAppearance is called after the annotation is added to a rotated page, then any text will be rotated in the opposite direction of the page rotation. If this method is called before the annotation is added to any rotated page, then no counter rotation will be applied. If you wish to call RefreshAppearance on an annotation already added to a rotated page, but you don’t want the text to be rotated, you can do one of the following; temporarily un-rotate the page, or, temporarily remove the Rotate object from the annotation. To support users adding text annotations while using a PDF viewer, you can also add any viewer rotation to the annotations Rotate object, to have text always rotated correctly, from the users perspective.

    Declaration

    Objective-C

    - (void)RefreshAppearance;

    Swift

    func refreshAppearance()
  • Returns custom data associated with the given key.

    Declaration

    Objective-C

    - (NSString *)GetCustomData:(NSString *)key;

    Swift

    func getCustomData(_ key: String!) -> String!

    Parameters

    key

    The key for which to retrieve the associated data.

    Return Value

    the custom data string. If no data is available an empty string is returned.

  • Sets the custom data associated with the specified key.

    Declaration

    Objective-C

    - (void)SetCustomData:(NSString *)key value:(NSString *)value;

    Swift

    func setCustomData(_ key: String!, value: String!)

    Parameters

    key

    The key under which to store this custom data

    value

    The custom data string to store

  • Deletes custom data associated with the given key.

    Declaration

    Objective-C

    - (void)DeleteCustomData:(NSString *)key;

    Swift

    func deleteCustomData(_ key: String!)

    Parameters

    key

    The key for which to delete the associated data.

  • 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.

    Declaration

    Objective-C

    - (void)Resize:(PTPDFRect *)newrect;

    Swift

    func resize(_ newrect: PTPDFRect!)

    Parameters

    newrect

    A reference to the new rectangle to which this annotation has to be resized.

  • Undocumented

    Declaration

    Objective-C

    + (PTAnnot*)CreateInternal: (unsigned long long)impl;

    Swift

    class func createInternal(_ impl: UInt64) -> PTAnnot!
  • Undocumented

    Declaration

    Objective-C

    - (unsigned long long)GetHandleInternal;

    Swift

    func getHandleInternal() -> UInt64
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)initWithD: (PTObj*)d;

    Swift

    init!(d: PTObj!)
  • The extended annotation type, which takes various annotation properties (border effect, etc.) into account.

    Declaration

    Objective-C

    @property (readonly, assign, nonatomic) PTExtendedAnnotType extendedAnnotType;

    Swift

    var extendedAnnotType: PTExtendedAnnotType { get }