PTToolManager

The PTToolManager class is responsbile for forwarding events from the PDFViewCtrl to Tools, and coordinating the control and data flow between tools.

  • The current tool.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic, nullable) PTTool *tool;

    Swift

    var tool: PTTool? { get set }
  • An object that conforms to the PTToolManagerDelegate protocol.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) id<PTToolManagerDelegate> delegate;

    Swift

    weak var delegate: PTToolManagerDelegate? { get set }
  • The PTPDFViewCtrl that the PTToolManager was initialized with.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PTPDFViewCtrl *_Nullable pdfViewCtrl;

    Swift

    weak var pdfViewCtrl: PTPDFViewCtrl? { get }
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly, weak) UIViewController *viewController

    Swift

    weak var viewController: UIViewController? { get }
  • Returns a newly initialized tool manager with the required pointer to the PTPDFViewCtrl on which it will operate.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithPDFViewCtrl:
        (nonnull PTPDFViewCtrl *)pdfViewCtrl;

    Swift

    init(pdfViewCtrl: PTPDFViewCtrl)

    Parameters

    pdfViewCtrl

    a pointer to the PTPDFViewCtrl that the tool manager will operate.

    Return Value

    A newly initialized tool manager object.

  • Create and set a new tool of the given type as the current tool.

    Declaration

    Objective-C

    - (nonnull PTTool *)changeTool:(nonnull Class)toolType;

    Swift

    func changeTool(_ toolType: AnyClass) -> PTTool
  • Selects the specified annotation.

    Declaration

    Objective-C

    - (BOOL)selectAnnotation:(nullable PTAnnot *)annotation
                onPageNumber:(unsigned long)pageNumber;

    Swift

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

    Parameters

    annotation

    the annotation to selected. If annotation is Nil, any selected annotation is deselected, and the tool is set to the default tool, typically PTPanTool.

    pageNumber

    the page number of the annotation

    Return Value

    YES if the annotation was selected, NO otherwise.

  • A string that will be used to set the author field of annotations that are created.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSString *annotationAuthor;

    Swift

    var annotationAuthor: String? { get set }
  • When true, the UIMenuController shows after a tap (in addition to after a long press). The default value of this property is false.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL showMenuOnTap;

    Swift

    var showMenuOnTap: Bool { get set }
  • When true, the digital signature tool allows the user to save signatures and apply previously saved signatures.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL showDefaultSignature;

    Swift

    var showDefaultSignature: Bool { get set }
  • Whether the built-in page number indicator is enabled. The default value of this property is false.

    Declaration

    Objective-C

    @property (getter=isPageIndicatorEnabled, assign, readwrite, nonatomic)
        BOOL pageIndicatorEnabled;

    Swift

    var isPageIndicatorEnabled: Bool { get set }
  • Whether the document associated with the PTPDFViewCtrl is read-only. The default value is NO.

    When in read-only mode, annotation creation and editing are disabled as well as other actions that would modify the document.

    Declaration

    Objective-C

    @property (getter=isReadonly, assign, readwrite, nonatomic) BOOL readonly;

    Swift

    var isReadonly: Bool { get set }
  • Returns whether the specified annotation allows editing.

    Declaration

    Objective-C

    - (BOOL)hasEditPermissionForAnnot:(nonnull PTAnnot *)annot;

    Swift

    func hasEditPermission(for annot: PTAnnot) -> Bool
  • Whether the permissions of an PTAnnot, returned via -[PTAnnot GetFlag:], are checked when determining whether the annotation can be edited. The default value of this property is NO.

    Declaration

    Objective-C

    @property (getter=isAnnotationPermissionCheckEnabled, assign, readwrite,
              nonatomic) BOOL annotationPermissionCheckEnabled;

    Swift

    var isAnnotationPermissionCheckEnabled: Bool { get set }
  • Whether the author of an PTAnnot is checked against the current annotationAuthor when determining whether the annotation can be edited. The default value of this property is NO.

    Declaration

    Objective-C

    @property (getter=isAnnotationAuthorCheckEnabled, assign, readwrite, nonatomic)
        BOOL annotationAuthorCheckEnabled;

    Swift

    var isAnnotationAuthorCheckEnabled: Bool { get set }
  • A boolean value that determines whether text selection is enabled.

    Declaration

    Objective-C

    @property (getter=isTextSelectionEnabled, assign, readwrite, nonatomic)
        BOOL textSelectionEnabled;

    Swift

    var isTextSelectionEnabled: Bool { get set }
  • A boolean value that determines whether form filling is enabled.

    Declaration

    Objective-C

    @property (getter=isFormFillingEnabled, assign, readwrite, nonatomic)
        BOOL formFillingEnabled;

    Swift

    var isFormFillingEnabled: Bool { get set }
  • A boolean value that determines whether link following is enabled.

    Declaration

    Objective-C

    @property (getter=isLinkFollowingEnabled, assign, readwrite, nonatomic)
        BOOL linkFollowingEnabled;

    Swift

    var isLinkFollowingEnabled: Bool { get set }
  • A boolean value that determines whether the eraser tool is enabled.

    Declaration

    Objective-C

    @property (getter=isEraserEnabled, assign, readwrite, nonatomic)
        BOOL eraserEnabled;

    Swift

    var isEraserEnabled: Bool { get set }
  • A boolean value that determines whether free text annots should get automatically resized.

    Declaration

    Objective-C

    @property (getter=isAutoResizeFreeTextEnabled, assign, readwrite, nonatomic)
        BOOL autoResizeFreeTextEnabled;

    Swift

    var isAutoResizeFreeTextEnabled: Bool { get set }
  • A boolean value that determines whether measurement annots should snap to document geometry.

    Declaration

    Objective-C

    @property (getter=isSnapToDocumentGeometryEnabled, assign, readwrite, nonatomic)
        BOOL snapToDocumentGeometryEnabled;

    Swift

    var isSnapToDocumentGeometryEnabled: Bool { get set }
  • A boolean value that determines whether annots should snap to their initial aspect ratio while being resized.

    Declaration

    Objective-C

    @property (getter=isAnnotationsSnapToAspectRatioEnabled, assign, readwrite,
              nonatomic) BOOL annotationsSnapToAspectRatio;

    Swift

    var isAnnotationsSnapToAspectRatioEnabled: Bool { get set }
  • A boolean value that determines whether annotations are selected immediately after they are created. Default is true, or whatever value was last set by a PTToolsSettingsManager.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL selectAnnotationAfterCreation;

    Swift

    var selectAnnotationAfterCreation: Bool { get set }
  • A boolean value that determines whether PencilKit is used to create new free hand annotations. Availble only on iOS 13.1 and greater. Default is true, or whatever value was last set by a PTToolsSettingsManager.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL freehandUsesPencilKit;

    Swift

    var freehandUsesPencilKit: Bool { get set }
  • A file path pointing to the digital certificate to use for digital signatures.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic)
        NSURL *_Nonnull digitalCertificateLocation;

    Swift

    var digitalCertificateLocation: URL { get set }
  • Used to notify the tool manager that an annotation has been added.

    Declaration

    Objective-C

    - (void)annotationAdded:(nonnull PTAnnot *)annotation
               onPageNumber:(int)pageNumber;

    Swift

    func annotationAdded(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    The annotation that was added.

    pageNumber

    The page number of the PDF that the annotation was added to.

  • Used to notify the tool manager that an annotation will be modified

    Declaration

    Objective-C

    - (void)willModifyAnnotation:(nonnull PTAnnot *)annotation
                    onPageNumber:(int)pageNumber;

    Swift

    func willModifyAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    The annotation will be modified.

    pageNumber

    The page number of the PDF that the annotation was modified on.

  • Used to notify the tool manager that an annotation has been modified

    Declaration

    Objective-C

    - (void)annotationModified:(nonnull PTAnnot *)annotation
                  onPageNumber:(int)pageNumber;

    Swift

    func annotationModified(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    The annotation that was modified.

    pageNumber

    The page number of the PDF that the annotation was modified on.

  • Used to notify the tool manager that an annotation will be removed

    Declaration

    Objective-C

    - (void)willRemoveAnnotation:(nonnull PTAnnot *)annotation
                    onPageNumber:(int)pageNumber;

    Swift

    func willRemoveAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    The annotation will be removed.

    pageNumber

    The page number of the PDF that the annotation was removed from.

  • Used to notify the tool manager that an annotation has been removed.

    Declaration

    Objective-C

    - (void)annotationRemoved:(nonnull PTAnnot *)annotation
                 onPageNumber:(int)pageNumber;

    Swift

    func annotationRemoved(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    The annotation that was removed.

    pageNumber

    The page number of the PDF that the annotation was removed from.

  • Used to notify the tool manager that the data of a form field has been modified.

    Declaration

    Objective-C

    - (void)formFieldDataModified:(nonnull PTAnnot *)annotation
                     onPageNumber:(int)pageNumber;

    Swift

    func formFieldDataModified(_ annotation: PTAnnot, onPageNumber pageNumber: Int32)

    Parameters

    annotation

    The form field annotation that has modified data.

    pageNumber

    The page number of the PDF that the form field annotation is on.

  • Used to notify the tool manager that a page has been added.

    Declaration

    Objective-C

    - (void)pageAddedForPageNumber:(int)pageNumber;

    Swift

    func pageAdded(forPageNumber pageNumber: Int32)

    Parameters

    pageNumber

    The page number of the page that was added.

  • Used to notify the tool manager that a page has been moved. *

    • - parameter: oldPageNumber The old page number of the page.
    • - parameter: newPageNumber The new page number of the page.

    Declaration

    Objective-C

    - (void)pageMovedFromPageNumber:(int)oldPageNumber
                       toPageNumber:(int)newPageNumber;

    Swift

    func pageMoved(fromPageNumber oldPageNumber: Int32, toPageNumber newPageNumber: Int32)
  • Used to notify the tool manager that a page has been removed.

    Declaration

    Objective-C

    - (void)pageRemovedForPageNumber:(int)pageNumber;

    Swift

    func pageRemoved(forPageNumber pageNumber: Int32)

    Parameters

    pageNumber

    The page number of the page that was removed.