PTAnnotEditTool


@interface PTAnnotEditTool
    : PTTool <UIPopoverPresentationControllerDelegate, UITextViewDelegate,
              PTAnnotStyleViewControllerDelegate>

The PTAnnotEditTool is used to change the properties, position and size of annotations. It also handles link annotations.

  • The transparent parent view that holds the shaded annotation selection rectangle and resize handles.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) PTSelectionRectContainerView *_Nonnull selectionRectContainerView;

    Swift

    var selectionRectContainerView: PTSelectionRectContainerView { get }
  • When the user is resizing the annotation, the resize handle that is currently in use.

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly) UIView *_Nullable touchedSelectWidget;

    Swift

    weak var touchedSelectWidget: UIView? { get }
  • When true, only corner resize handles are available, and the aspect ratio will be maintained. Default is true for stamp and signatures annotations, false for others.

    Declaration

    Objective-C

    @property (nonatomic) BOOL maintainAspectRatio;

    Swift

    var maintainAspectRatio: Bool { get set }
  • When enabled, a visual guide is shown while resizing an annotation to indicate the line along which the annotation’s original aspect ratio is maintained.

    This property is enabled by default.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isAspectRatioGuideEnabled) BOOL aspectRatioGuideEnabled;

    Swift

    var isAspectRatioGuideEnabled: Bool { get set }
  • The minimum size that annotations can be resized to, expressed in page space. The default value is 0.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat minimumAnnotationSize;

    Swift

    var minimumAnnotationSize: CGFloat { get set }
  • The maximum size that annotations can be resized to, expressed in page space. By default, there is no maximum size limit.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat maximumAnnotationSize;

    Swift

    var maximumAnnotationSize: CGFloat { get set }
  • The PTAnnotEditTool‘s delegate object.

    Declaration

    Objective-C

    @property (nonatomic, weak, nullable) id<PTAnnotEditToolDelegate> delegate;

    Swift

    weak var delegate: PTAnnotEditToolDelegate? { get set }
  • Selects the specified annotation.

    Declaration

    Objective-C

    - (BOOL)selectAnnotation:(nonnull PTAnnot *)annotation
                onPageNumber:(unsigned int)pageNumber;

    Swift

    func selectAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: UInt32) -> Bool

    Parameters

    annotation

    the annotation to select

    pageNumber

    the page number of the annotation

    Return Value

    YES if the annotation was selected, NO otherwise.

  • Selects the specified annotation and optionally shows the annotation selection menu.

    Declaration

    Objective-C

    - (BOOL)selectAnnotation:(nonnull PTAnnot *)annotation
                onPageNumber:(unsigned int)pageNumber
                    showMenu:(BOOL)showMenu;

    Swift

    func selectAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: UInt32, showMenu: Bool) -> Bool

    Parameters

    annotation

    the annotation to select

    pageNumber

    the page number of the annotation

    showMenu

    whether the annotation selection menu should be shown

    Return Value

    YES if the annotation was selected, NO otherwise.

  • An array of selected annotations.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSArray<PTAnnot *> *_Nonnull selectedAnnotations;

    Swift

    var selectedAnnotations: [PTAnnot] { get set }
  • Sets the annotation’s border thickness.

    Declaration

    Objective-C

    - (void)setAnnotationBorder:(float)thickness;

    Swift

    func setAnnotationBorder(_ thickness: Float)
  • Selects the annotation where the user tapped or long pressed. If it is a link, the link will be followed.

    Declaration

    Objective-C

    - (BOOL)makeNewAnnotationSelection:
        (nonnull UIGestureRecognizer *)gestureRecognizer;

    Swift

    func makeNewAnnotationSelection(_ gestureRecognizer: UIGestureRecognizer) -> Bool
  • Deselects the currently selected annotation currentAnnotation.

    Declaration

    Objective-C

    - (void)deselectAnnotation;

    Swift

    func deselectAnnotation()
  • Sets the currentAnnotation‘s opacity.

    Declaration

    Objective-C

    - (void)setAnnotationOpacity:(double)opacity;

    Swift

    func setAnnotationOpacity(_ opacity: Double)
  • Action to flatten the currently selected annotations.

    Declaration

    Objective-C

    - (void)flattenSelectedAnnotations:(nonnull id)sender;

    Swift

    func flattenSelectedAnnotations(_ sender: Any)
  • Action to copy the currently selected annotations to the pasteboard.

    Declaration

    Objective-C

    - (void)copySelectedAnnotations:(nonnull id)sender;

    Swift

    func copySelectedAnnotations(_ sender: Any)
  • Allows the user to set the currentAnnotation‘s stroke color.

    Declaration

    Objective-C

    - (void)editSelectedAnnotationStrokeColor;

    Swift

    func editSelectedAnnotationStrokeColor()
  • Allows the user to set the currentAnnotation‘s border thickness.

    Declaration

    Objective-C

    - (void)editSelectedAnnotationBorder;

    Swift

    func editSelectedAnnotationBorder()
  • Allows the user to set the currentAnnotation‘s opacity.

    Declaration

    Objective-C

    - (void)editSelectedAnnotationOpacity;

    Swift

    func editSelectedAnnotationOpacity()
  • Edits the currently selected PTFreeText annotation’s contents.

    Declaration

    Objective-C

    - (void)editSelectedAnnotationFreeText;

    Swift

    func editSelectedAnnotationFreeText()
  • Allows the user to edit the currentAnnotation‘s style.

    Declaration

    Objective-C

    - (void)editSelectedAnnotationStyle;

    Swift

    func editSelectedAnnotationStyle()
  • Commits the user-selected style for the currentAnnotation.

    Declaration

    Objective-C

    - (void)commitSelectedAnnotationStyle;

    Swift

    func commitSelectedAnnotationStyle()
  • Allows the user to edit the currentAnnotation‘s date. This method only functions correctly if the currentAnnotation has an extendedAnnotType of PTExtendedAnnotTypeDateText.

    Declaration

    Objective-C

    - (void)editSelectedDateTextAnnotationDate;

    Swift

    func editSelectedDateTextAnnotationDate()
  • Action method to export and save the currently selected file attachment annotation to disk.

    Declaration

    Objective-C

    - (void)saveFileAttachmentAnnotation:(nullable id)sender;

    Swift

    func saveFileAttachmentAnnotation(_ sender: Any?)
  • Undocumented

    Declaration

    Objective-C

    - (void)redactDoc;

    Swift

    func redactDoc()
  • Used to allow the toolmanager that the user wishes to open a file attachment

    Declaration

    Objective-C

    - (void)handleFileAttachment:(nonnull PTFileAttachment *)fileAttachment
                    onPageNumber:(unsigned long)pageNumber;

    Swift

    func handle(_ fileAttachment: PTFileAttachment, onPageNumber pageNumber: UInt)

    Parameters

    fileAttachment

    The file attachment.

    pageNumber

    The page number that the annotation is on.

  • Override point for when the user has requested to save the file attchment

    Declaration

    Objective-C

    - (void)saveFileAttachment:(nonnull PTFileAttachment *)fileAttachment
                  onPageNumber:(unsigned long)pageNumber;

    Swift

    func save(_ fileAttachment: PTFileAttachment, onPageNumber pageNumber: UInt)

    Parameters

    fileAttachment

    The file attachment to be saved.

    pageNumber

    The page number that the annotation is on.

  • Returns a tight page bounding box around the annotation.

    The default implementation of this method returns the value of -[PTAnnot GetRect].

    Declaration

    Objective-C

    - (nonnull PTPDFRect *)tightPageBoundingBoxFromAnnot:(nonnull PTAnnot *)annot;

    Swift

    func tightPageBoundingBox(from annot: PTAnnot) -> PTPDFRect

    Parameters

    annot

    the annotation

    Return Value

    a tight page bounding box around the annotation

  • Returns a tight screen bounding box around the annotation.

    The default implementation of this method returns the value of -[PTAnnot GetRect], in screen coordinates.

    Declaration

    Objective-C

    - (CGRect)tightScreenBoundingBoxForAnnot:(nonnull PTAnnot *)annot
                                onPageNumber:(int)pageNumber;

    Swift

    func tightScreenBoundingBox(for annot: PTAnnot, onPageNumber pageNumber: Int32) -> CGRect

    Parameters

    annot

    the annotation

    pageNumber

    the annotation’s page number

    Return Value

    a tight screen bounding box around the annotation

  • Bounds a point in screen space to the current page’s crop box.

    Declaration

    Objective-C

    - (CGPoint)boundPointToPage:(CGPoint)point;

    Swift

    func boundPoint(toPage point: CGPoint) -> CGPoint

    Parameters

    point

    a point in screen space

    Return Value

    a point in screen space, guaranteed to be within the page.

  • Ensures that a rect in page space is within the page it’s on.

    Declaration

    Objective-C

    - (nonnull PTPDFRect *)boundPageRect:(nonnull PTPDFRect *)pageRect
                                  toPage:(int)pageNumber;

    Swift

    func boundPageRect(_ pageRect: PTPDFRect, toPage pageNumber: Int32) -> PTPDFRect

    Parameters

    pageRect

    the rect in page space

    pageNumber

    the page number

    Return Value

    the new rectangle, guaranteed to be within the page.

  • Ensures that a new rect’s position lies within the page it’s on.

    Declaration

    Objective-C

    - (CGRect)boundRectToPage:(CGRect)annotRect isResizing:(BOOL)resizing;

    Swift

    func boundRect(toPage annotRect: CGRect, isResizing resizing: Bool) -> CGRect

    Parameters

    annotRect

    the annotation’s proposed new rectangle.

    resizing

    if the annotation was changed via a resize (as opposed to a move)

    Return Value

    the new rectangle, guaranteed to be within the page.