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 (nonatomic, strong, readwrite, nullable) PTTool *tool;

    Swift

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

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

    @property (nonatomic, weak, readonly) 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.

  • Prompts the user for bluetooth permission if they have not been already

    Used as part of detecting if an Apple Pencil is paired with the device.

    Will never prompt on iPhones.

    Declaration

    Objective-C

    - (void)promptForBluetoothPermission;

    Swift

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

    Declaration

    Objective-C

    @property (nonatomic, copy, readwrite, 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 (nonatomic, assign, unsafe_unretained, readwrite) 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 (nonatomic, assign, unsafe_unretained, readwrite)
        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 (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isPageIndicatorEnabled) 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 (nonatomic, assign, unsafe_unretained, readwrite, getter=isReadonly)
        BOOL readonly;

    Swift

    var isReadonly: Bool { get set }
  • Whether the tool should only create annotations with Apple Pencil touches and not finger touches.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL annotationsCreatedWithPencilOnly;

    Swift

    var annotationsCreatedWithPencilOnly: Bool { get }
  • Controls if Apple’s bluetooth permission prompt will be triggered the first time an Apple Pencil touch is detected, so that the system setting to only annotate with the Apple Pencil can be ignored when no Apple Pencil is currently paired with the device.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite)
        BOOL allowBluetoothPermissionPrompt;

    Swift

    var allowBluetoothPermissionPrompt: 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 (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isAnnotationPermissionCheckEnabled)
        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 (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isAnnotationAuthorCheckEnabled)
        BOOL annotationAuthorCheckEnabled;

    Swift

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

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

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

    Swift

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

    The default value is true.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isAutoResizeFreeTextEnabled) 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 (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isSnapToDocumentGeometryEnabled)
        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 (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isAnnotationsSnapToAspectRatioEnabled)
        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 (nonatomic, assign, unsafe_unretained, readwrite)
        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 (nonatomic, assign, unsafe_unretained, readwrite)
        BOOL freehandUsesPencilKit;

    Swift

    var freehandUsesPencilKit: Bool { get set }
  • A boolean value that determines whether highlight-only annotations made with PencilKit use a multiply blend mode. Default is true, or whatever value was last set by a PTToolsSettingsManager.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite)
        BOOL pencilHighlightMultiplyBlendModeEnabled;

    Swift

    var pencilHighlightMultiplyBlendModeEnabled: Bool { get set }
  • A value that determines whether only Pencil touches should be used for annotating. Default is to obey the iOS system setting, or whatever value was last set by a PTToolsSettingsManager.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite)
        PTPencilInteractionMode pencilInteractionMode;

    Swift

    var pencilInteractionMode: PTPencilInteractionMode { get set }
  • A boolean value that determines if selected text will include an “edit” option that allows the user to edit the underlying PDF text. This feature is in development and is currently considered Beta. Please contact us if you are interested in a more advanced version that the current behaviour.

    Default value is false.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite)
        BOOL textEditingEnabled;

    Swift

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

    Declaration

    Objective-C

    @property (nonatomic, strong, readwrite)
        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.