PTTool


@interface PTTool
    : UIView <PTOverridable, UIGestureRecognizerDelegate, PTToolSwitching,
              PTNoteEditControllerDelegate, PTLinkPopupViewControllerDelegate,
              UIPopoverPresentationControllerDelegate,
              UIAdaptivePresentationControllerDelegate>

The PTTool base class from which all stock tools derive. These tools implement the PTToolSwitching protocol. For documentation on these methods, please see the protocol documentation, available at http://www.pdftron.com

  • The page number of the currentAnnotation.

    Declaration

    Objective-C

    @property (nonatomic) unsigned int annotationPageNumber;

    Swift

    var annotationPageNumber: UInt32 { get set }
  • The location of a long press within the coordinate system of the PTPDFViewCtrl (screen coordinates).

    Declaration

    Objective-C

    @property (nonatomic) CGPoint longPressPoint;

    Swift

    var longPressPoint: CGPoint { get set }
  • The tools have one active annotation at a time, which is pointed to by this property.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) PTAnnot *currentAnnotation;

    Swift

    var currentAnnotation: PTAnnot? { get set }
  • If YES, an annotation creation tool will switch back to the defaultClass tool, typically the PTPanTool, after the annotation is created. If NO, the annotation creation tool will remain active, so the next set of touches will create another annotation.

    Declaration

    Objective-C

    @property (nonatomic) BOOL backToPanToolAfterUse;

    Swift

    var backToPanToolAfterUse: Bool { get set }
  • Class of tool to use when document is interacted with after creating a tool. If backToPanToolAfterUse is YES, then this will normally be the PTPanTool. Otherwise it will be the currently used annotation creation tool.

    Declaration

    Objective-C

    @property (nonatomic) Class _Nonnull defaultClass;

    Swift

    var defaultClass: AnyClass { get set }
  • Class of tool to pass the event on to if the current tool if it needs further processing.

    Declaration

    Objective-C

    @property (nonatomic, nullable) Class nextToolType;

    Swift

    var nextToolType: AnyClass? { get set }
  • Class of previous tool that created the current tool.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) Class previousToolType;

    Swift

    var previousToolType: AnyClass? { get set }
  • The PDFNet class that this tool creates.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) Class _Nonnull annotClass;

    Swift

    var annotClass: AnyClass { get }
  • The PDFNet annot type that this tool creates.

    Declaration

    Objective-C

    @property (nonatomic, readonly) PTExtendedAnnotType annotType;

    Swift

    var annotType: PTExtendedAnnotType { get }
  • The PDFNet annot type that this tool creates.

    Declaration

    Objective-C

    @property (class, nonatomic, readonly) PTExtendedAnnotType annotType;

    Swift

    class var annotType: PTExtendedAnnotType { get }
  • Indicates if the tool type can be used to create an annotation.

    The default value is NO.

    Declaration

    Objective-C

    @property (class, nonatomic, readonly) BOOL createsAnnotation;

    Swift

    class var createsAnnotation: Bool { get }
  • The image to display for this tool.

    The default implementation uses the annotation type from annotType to determine which image to use. If the annotType is PTExtendedAnnotTypeUnknown then this property is nil.

    This property can be overridden in a subclass to provide a custom value.

    Declaration

    Objective-C

    @property (class, nonatomic, strong, readonly, nullable) UIImage *image;

    Swift

    class var image: UIImage? { get }
  • The localized name of this tool.

    The default implementation uses the annotation type from annotType to determine the name to use. If the annotType is PTExtendedAnnotTypeUnknown then this property is nil.

    This property can be overridden in a subclass to provide a custom value.

    Declaration

    Objective-C

    @property (class, nonatomic, copy, readonly, nullable) NSString *localizedName;

    Swift

    class var localizedName: String? { get }
  • The identifier of this tool.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSString *identifier;

    Swift

    var identifier: String? { get set }
  • Used to check if this tool can have its style modified.

    The default value is taken from the class-method +[PTTool canEditStyle].

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL canEditStyle;

    Swift

    var canEditStyle: Bool { get }
  • Used to check if this tool can have its style modified.

    The default value is NO.

    Declaration

    Objective-C

    @property (class, nonatomic, readonly) BOOL canEditStyle;

    Swift

    class var canEditStyle: Bool { get }
  • Tools can add a page number indicator to the PTPDFViewCtrl. This boolean turns its visibility on and off.

    Declaration

    Objective-C

    @property (nonatomic) BOOL pageIndicatorIsVisible;

    Swift

    var pageIndicatorIsVisible: Bool { get set }
  • Acrobat and Preview do not follow the PDF specification regarding the ordering of quad points in a text markup annotation. Enable this code for compatibility with those viewers.

    Declaration

    Objective-C

    @property (nonatomic) BOOL textMarkupAdobeHack;

    Swift

    var textMarkupAdobeHack: Bool { get set }
  • Used to track if the tool should forward the touch events to the PTPDFViewCtrl for scrolling.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL allowScrolling;

    Swift

    var allowScrolling: Bool { get }
  • Used to track if the tool should allow the PTPDFViewCtrl to zoom.

    Declaration

    Objective-C

    @property (nonatomic) BOOL allowZoom;

    Swift

    var allowZoom: Bool { get set }
  • Whether this tool maintains an NSUndoManager with its own undo stack.

    When YES, the tool’s undoManager property (inherited from UIResponder) will be an undo manager with an undo stack of the tool’s actions. When NO, the tool does not have its own undo manager and the undoManager property will respect the standard UIResponder flow (goes up the responder chain to find the first non-null NSUndoManager instance, stopping at the root UIWindow).

    The default value is NO.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readonly,
              getter=isUndoManagerEnabled) BOOL undoManagerEnabled;

    Swift

    var isUndoManagerEnabled: Bool { get }
  • Declaration

    Objective-C

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

    Swift

    init(pdfViewCtrl: PTPDFViewCtrl)
  • Requests action object to be executed by the PTPDFViewCtrl. The action must belong to the document currently displayed in the PTPDFViewCtrl.

    Declaration

    Objective-C

    - (void)executeAction:(nonnull PTActionParameter *)action_param;

    Swift

    func executeAction(_ action_param: PTActionParameter)

    Parameters

    action_param

    The object that is to be executed.

  • Commits any pending annotation changes to the document.

    The default implementation of this method does nothing. Subclasses of the PTTool base class should override this method to commit pending annotation changes to the document.

    Declaration

    Objective-C

    - (void)commitAnnotation;

    Swift

    func commitAnnotation()
  • A convenience method that handles notifying the tool manager before and after the annotation is modified.

    Declaration

    Objective-C

    - (void)modifyAnnotation:(nonnull PTAnnot *)annotation
                onPageNumber:(unsigned int)pageNumber
                   withBlock:
                       (nonnull void (^)(PTAnnot *_Nonnull, unsigned int))block;

    Swift

    func modifyAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: UInt32, with block: (PTAnnot, UInt32) -> Void)

    Parameters

    annotation

    The annotation to be modified

    pageNumber

    The PDF page number of the annotation

    block

    A block that is executed synchronously and receives the annotation and page number as parameters. The -willModifyAnnotation:onPageNumber: method will be called before the block is executed and the -annotationModified:onPageNumber: method is called afterwards.

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

    Declaration

    Objective-C

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

    Swift

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

    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 the tool has modified an annotation.

    Declaration

    Objective-C

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

    Swift

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

    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 the tool will modify an annotation.

    Declaration

    Objective-C

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

    Swift

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

    Parameters

    annotation

    The annotation that will be modified.

    pageNumber

    The page number of the PDF that the annotation will be modified on.

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

    Declaration

    Objective-C

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

    Swift

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

    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 tool will remove an annotation.

    Declaration

    Objective-C

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

    Swift

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

    Parameters

    annotation

    The annotation that will be removed.

    pageNumber

    The page number of the PDF that the annotation will be removed from.

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

    Declaration

    Objective-C

    - (void)annotationFlattened:(nonnull PTAnnot *)annotation
                   onPageNumber:(unsigned long)pageNumber;

    Swift

    func annotationFlattened(_ annotation: PTAnnot, onPageNumber pageNumber: UInt)

    Parameters

    annotation

    The annotation that was flattened.

    pageNumber

    The page number of the PDF that the annotation was flattened onto.

  • Used to notify the tool manager that the tool will flatten an annotation.

    Declaration

    Objective-C

    - (void)willFlattenAnnotation:(nonnull PTAnnot *)annotation
                     onPageNumber:(unsigned long)pageNumber;

    Swift

    func willFlattenAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: UInt)

    Parameters

    annotation

    The annotation that will be flattened.

    pageNumber

    The page number of the PDF that the annotation will be flattened onto.

  • Used to notify the tool manager that the tool has modified a form field’s data.

    Declaration

    Objective-C

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

    Swift

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

    Parameters

    annotation

    The form field annotation’s that had its data modified

    pageNumber

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

  • Used to allow the tool manager to control whether the tool should interact with the form annotation on pageNumber.

    Declaration

    Objective-C

    - (BOOL)shouldInteractWithForm:(nonnull PTAnnot *)annotation
                      onPageNumber:(unsigned long)pageNumber;

    Swift

    func shouldInteract(withForm annotation: PTAnnot, onPageNumber pageNumber: UInt) -> Bool

    Parameters

    annotation

    The annotation that will be selected

    pageNumber

    The page number that the annotation is on.

    Return Value

    YES if the tool should continue to select the annotation; NO if not.

  • Used to allow the tool mananger to control whether the tool should handle the Apple Pencil Scribble interaction for a given annotation on pageNumber.

    Declaration

    Objective-C

    - (BOOL)shouldHandleIndirectScribbleInteraction:
                (nonnull UIIndirectScribbleInteraction *)scribbleInteraction
                                      forAnnotation:(nonnull PTAnnot *)annotation
                                       onPageNumber:(unsigned long)pageNumber;

    Swift

    func shouldHandle(_ scribbleInteraction: __UIIndirectScribbleInteraction, forAnnotation annotation: PTAnnot, onPageNumber pageNumber: UInt) -> Bool

    Parameters

    scribbleInteraction

    The scribble interaction that will be performed.

    annotation

    The annotation.

    pageNumber

    The page number that the annotation is on.

    Return Value

    YES if the tool should allow for scribble input for the annotation; NO if not.

  • Used to allow the tool manager to control whether the tool can edit the annotation on pageNumber.

    Declaration

    Objective-C

    - (BOOL)canEditAnnotation:(nonnull PTAnnot *)annotation
                 onPageNumber:(unsigned long)pageNumber;

    Swift

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

    Parameters

    annotation

    The annotation that will be edited

    pageNumber

    The page number that the annotation is on.

    Return Value

    YES if the tool should continue to edit the annotation; NO if not.

  • Used to allow the tool manager to control whether the tool should select the given annotation on pageNumber.

    Declaration

    Objective-C

    - (BOOL)shouldSelectAnnotation:(nonnull PTAnnot *)annotation
                      onPageNumber:(unsigned long)pageNumber;

    Swift

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

    Parameters

    annotation

    The annotation that will be activated

    pageNumber

    The page number that the annotation is on.

    Return Value

    YES if the tool should activate the form annotation; NO if not.

  • Used to notify the tool manager that the tool will select an annotation.

    Declaration

    Objective-C

    - (void)willSelectAnnotation:(nonnull PTAnnot *)annotation
                    onPageNumber:(unsigned long)pageNumber;

    Swift

    func willSelectAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: UInt)

    Parameters

    annotation

    The annotation that will be selected

    pageNumber

    The page number of the PDF that the annotation is on

  • Used to notify the tool manager that the tool selected an annotation.

    Declaration

    Objective-C

    - (void)didSelectAnnotation:(nonnull PTAnnot *)annotation
                   onPageNumber:(unsigned long)pageNumber;

    Swift

    func didSelectAnnotation(_ annotation: PTAnnot, onPageNumber pageNumber: UInt)

    Parameters

    annotation

    The annotation that was selected

    pageNumber

    The page number of the PDF that the annotation was selected on

  • Used to notify the tool manager that text will be copied.

    Declaration

    Objective-C

    - (nullable NSString *)willCopyReturnedText:(nullable NSString *)selectedText
                                   toPasteboard:(nonnull UIPasteboard *)pasteboard;

    Swift

    func willCopyReturnedText(_ selectedText: String?, to pasteboard: UIPasteboard) -> String?

    Parameters

    selectedText

    The text to be copied, based on the user’s current selection.

    pasteboard

    The pasteboard to which the text will be copied

    Return Value

    The text that will be copied to the pasteboard. This return value can be different from the value of the textToCopy parameter.

  • Used to notify the tool manager that text was copied.

    Declaration

    Objective-C

    - (void)didCopyText:(nullable NSString *)copiedText
           toPasteboard:(nonnull UIPasteboard *)pasteboard;

    Swift

    func didCopyText(_ copiedText: String?, to pasteboard: UIPasteboard)

    Parameters

    copiedText

    The text that was copied

    pasteboard

    The pasteboard to which the text was copied

  • Used to allow the tool manager to control whether to show a menu controller for the given annotation and page number.

    Declaration

    Objective-C

    - (BOOL)shouldShowMenu:(nonnull UIMenuController *)menuController
             forAnnotation:(nullable PTAnnot *)annotation
              onPageNumber:(unsigned long)pageNumber;

    Swift

    func shouldShowMenu(_ menuController: UIMenuController, forAnnotation annotation: PTAnnot?, onPageNumber pageNumber: UInt) -> Bool

    Parameters

    annotation

    The annotation that will be selected.

    pageNumber

    The page number that the annotation is on.

    Return Value

    YES if the tool should show the UIMenuController; NO if not.

  • Used to allow the tool manager to take over link handling. Links can either be annotations, or detected as links by PDFNet via text pattern matching. One of the two first parameters will have a value, the other will be nil.

    Declaration

    Objective-C

    - (BOOL)shouldHandleLinkAnnotation:(nullable PTAnnot *)annotation
                            orLinkInfo:(nullable PTLinkInfo *)linkInfo
                          onPageNumber:(unsigned long)pageNumber;

    Swift

    func shouldHandleLinkAnnotation(_ annotation: PTAnnot?, orLinkInfo linkInfo: PTLinkInfo?, onPageNumber pageNumber: UInt) -> Bool

    Parameters

    annotation

    The link annotation, if it exists, that will be handled. If there is not a link annotation, then nil.

    linkInfo

    If it exists, the text that was detected as matching the format of a link. nil otherwise.

    pageNumber

    The page number that the annotation or link is on.

    Return Value

    YES if the tool should handle the link; NO if not.

  • Used to set the background color for sticky note annotation.

    Declaration

    Objective-C

    - (void)setBackgroundColorForNote:
                (nonnull PTNoteEditController *)noteEditController
                            fillColor:(nonnull UIColor *)fillColor;

    Swift

    func setBackgroundColorForNote(_ noteEditController: PTNoteEditController, fill fillColor: UIColor)

    Parameters

    noteEditController

    The note edit controller of the annotation.

    fillColor

    The fill color of the sticky note annotation.

  • Used to set the bar buttons’ tint color for sticky note annotation.

    Declaration

    Objective-C

    - (void)setBarButtonColorForNote:
                (nonnull PTNoteEditController *)noteEditController
                           fillColor:(nonnull UIColor *)barButtonColor;

    Swift

    func setBarButtonColorForNote(_ noteEditController: PTNoteEditController, fill barButtonColor: UIColor)

    Parameters

    noteEditController

    The note edit controller of the annotation.

    barButtonColor

    The bar buttons’ color of the sticky note annotation.

  • Call to edit the current annotation’s note.

    Declaration

    Objective-C

    - (void)editSelectedAnnotationNote;

    Swift

    func editSelectedAnnotationNote()
  • Flattens the specified annotation(s) on the current page.

    See

    -flattenAnnotations:onPageNumber:withError

    Declaration

    Objective-C

    - (void)flattenAnnotations:(nonnull NSArray<PTAnnot *> *)annotations;

    Swift

    func flattenAnnotations(_ annotations: [PTAnnot])

    Parameters

    annotations

    the annotations to flatten

  • Flattens the specified annotations.

    Declaration

    Objective-C

    - (BOOL)flattenAnnotations:(nonnull NSArray<PTAnnot *> *)annotations
                  onPageNumber:(int)pageNumber
                     withError:(NSError *_Nullable *_Nullable)error;

    Swift

    func flattenAnnotations(_ annotations: [PTAnnot], onPageNumber pageNumber: Int32) throws

    Parameters

    annotations

    the annotations to flatten

    pageNumber

    the page number of the annotations

    error

    On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

    Return Value

    YES if the annotations were flattened into the page, NO otherwise.

  • Deletes the current annotation.

    Declaration

    Objective-C

    - (void)deleteSelectedAnnotation;

    Swift

    func deleteSelectedAnnotation()
  • Call to keep the current tool’s appearance on screen even after the tool is destroyed. This prevents a possible annotation “flash” as the PDF under a newly created annotation is re-rendered with the new annotation. The appearance is automatically removed when the PDFViewCtrl finishes its next render (or when its layout changes).

    Declaration

    Objective-C

    - (void)keepToolAppearanceOnScreen;

    Swift

    func keepAppearanceOnScreen()
  • Keeps a tool’s appearance on screen using the provided imageView. See keepToolAppearanceOnScreen.

    Declaration

    Objective-C

    - (void)keepToolAppearanceOnScreenWithImageView:
        (nonnull UIImageView *)imageView;

    Swift

    func keepAppearanceOnScreen(with imageView: UIImageView)

    Parameters

    imageView

    The image view to temporarily keep on screen.

  • Call to explicitly remove an tool appearances that have have been kept on screen by a call too keepToolAppearanceOnScreen.

    Declaration

    Objective-C

    - (void)removeAppearanceViews;

    Swift

    func removeAppearanceViews()
  • Shows a UIMenuController with options relevant for the current tool.

    Declaration

    Objective-C

    - (void)showSelectionMenu:(CGRect)targetScreenRect animated:(BOOL)animated;

    Swift

    func showSelectionMenu(_ targetScreenRect: CGRect, animated: Bool)

    Parameters

    targetScreenRect

    The screen-rect that the menu will be anchored to. A value of CGRectZero will show the menu without setting its target rect.

    animated

    Whether to animate the change

  • Shows a UIMenuController with options relevant for the current tool.

    Declaration

    Objective-C

    - (void)showSelectionMenu:(CGRect)targetScreenRect;

    Swift

    func showSelectionMenu(_ targetScreenRect: CGRect)
  • Hides the UIMenuController.

    Declaration

    Objective-C

    - (void)hideMenu;

    Swift

    func hideMenu()
  • Returns the PDF page crop box for the specified page number.

    Declaration

    Objective-C

    - (nullable PTPDFRect *)pageCropBoxForPageNumber:(int)pageNumber;

    Swift

    func pageCropBox(forPageNumber pageNumber: Int32) -> PTPDFRect?

    Parameters

    pageNumber

    the page number

    Return Value

    the page crop box in page points.

  • Returns the page rotation for the specified page number.

    Declaration

    Objective-C

    - (PTRotate)pageRotationForPageNumber:(int)pageNumber;

    Swift

    func pageRotation(forPageNumber pageNumber: Int32) -> PTRotate

    Parameters

    pageNumber

    the page number

    Return Value

    the page rotation for the specified page number

  • Computes the PDF page box in screen (PTPDFViewCtrl) coordinates.

    Declaration

    Objective-C

    - (nullable PTPDFRect *)pageBoxInScreenPtsForPageNumber:(int)pageNumber;

    Swift

    func pageBoxInScreenPts(forPageNumber pageNumber: Int32) -> PTPDFRect?

    Parameters

    pageNumber

    the page number

    Return Value

    the page box in screen points.

  • Returns the union of two rectangles

    Declaration

    Objective-C

    + (nonnull PTPDFRect *)GetRectUnion:(nonnull PTPDFRect *)rect1
                                  Rect2:(nonnull PTPDFRect *)rect2;

    Swift

    class func getRectUnion(_ rect1: PTPDFRect, rect2: PTPDFRect) -> PTPDFRect
  • Converts a point in screen (PTPDFViewCtrl) coordinates to a PDF page coordinate.

    Declaration

    Objective-C

    - (CGPoint)convertScreenPtToPagePt:(CGPoint)screenPoint
                          onPageNumber:(int)pageNumber;

    Swift

    func convertScreenPt(toPagePt screenPoint: CGPoint, onPageNumber pageNumber: Int32) -> CGPoint
  • Converts a point in screen (PTPDFViewCtrl) coordinates to a PDF page coordinate.

    Declaration

    Objective-C

    - (void)ConvertScreenPtToPagePtX:(nonnull CGFloat *)x
                                   Y:(nonnull CGFloat *)y
                          PageNumber:(int)pageNumber;

    Swift

    func convertScreenPt(toPagePtX x: UnsafeMutablePointer<CGFloat>, y: UnsafeMutablePointer<CGFloat>, pageNumber: Int32)
  • Converts a point in page coordinates to screen (PTPDFViewCtrl) coordinates.

    Declaration

    Objective-C

    - (void)ConvertPagePtToScreenPtX:(nonnull CGFloat *)x
                                   Y:(nonnull CGFloat *)y
                          PageNumber:(int)pageNumber;

    Swift

    func convertPagePt(toScreenPtX x: UnsafeMutablePointer<CGFloat>, y: UnsafeMutablePointer<CGFloat>, pageNumber: Int32)
  • Converts a point in page coordinates to screen (PTPDFViewCtrl) coordinates.

    Declaration

    Objective-C

    - (CGPoint)convertPagePtToScreenPt:(CGPoint)pagePoint
                          onPageNumber:(int)pageNumber;

    Swift

    func convertPagePt(toScreenPt pagePoint: CGPoint, onPageNumber pageNumber: Int32) -> CGPoint
  • Converts a PTPDFRect in PDF page coordinates to a CGRect in screen (PTPDFViewCtrl) coordinates.

    Declaration

    Objective-C

    - (CGRect)PDFRectPage2CGRectScreen:(nonnull PTPDFRect *)r
                            PageNumber:(int)pageNumber;

    Swift

    func pdfRectPage2CGRectScreen(_ r: PTPDFRect, pageNumber: Int32) -> CGRect
  • Converts a PTPDFRect in screen (PTPDFViewCtrl) coordinates to a CGRect in screen (PTPDFViewCtrl) coordinates.

    Declaration

    Objective-C

    - (CGRect)PDFRectScreen2CGRectScreen:(nonnull PTPDFRect *)r;

    Swift

    func pdfRectScreen2CGRectScreen(_ r: PTPDFRect) -> CGRect
  • Converts a PTPDFRect in screen (PTPDFViewCtrl) coordinates to a CGRect in screen (PTPDFViewCtrl) coordinates.

    Declaration

    Objective-C

    - (CGRect)PDFRectScreen2CGRectScreen:(nonnull PTPDFRect *)r
                              PageNumber:(int)pageNumber;

    Swift

    func pdfRectScreen2CGRectScreen(_ r: PTPDFRect, pageNumber: Int32) -> CGRect
  • Converts a CGRect in screen (PTPDFViewCtrl) coordinates to a PTPDFRect in PDF page coordinates.

    Declaration

    Objective-C

    - (nonnull PTPDFRect *)CGRectScreen2PDFRectPage:(CGRect)screenRect
                                         PageNumber:(int)pageNumber;

    Swift

    func cgRectScreen2PDFRectPage(_ screenRect: CGRect, pageNumber: Int32) -> PTPDFRect
  • Converts a CGRect in screen (PTPDFViewCtrl) coordinates to a CGRect in canvas coordinates.

    Declaration

    Objective-C

    - (CGRect)CGRectScreenToCGRectCanvas:(CGRect)screenRect;

    Swift

    func cgRectScreen(toCGRectCanvas screenRect: CGRect) -> CGRect
  • Converts a CGRect in canvas coordinates to a CGRect in screen (PTPDFViewCtrl) coordinates.

    Declaration

    Objective-C

    - (CGRect)CGRectCanvasToCGRectScreen:(CGRect)canvasRect;

    Swift

    func cgRectCanvas(toCGRectScreen canvasRect: CGRect) -> CGRect
  • Declaration

    Objective-C

    - (nonnull instancetype)initWithFrame:(CGRect)frame;
  • Undocumented

    Declaration

    Objective-C

    -(instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
  • Undocumented

    Declaration

    Objective-C

    -(instancetype)init NS_UNAVAILABLE;
  • Computes the snapped rect of a resizing annotation.

    Declaration

    Objective-C

    - (CGRect)screenRectOfResizingAnnotationClosestToPosition:(CGRect)position;

    Swift

    func screenRectOfResizingAnnotationClosest(toPosition position: CGRect) -> CGRect

    Parameters

    position

    the current cgrect position of the annotation.

    Return Value

    the snapped cgrect position of the annotation.

  • Computes the snapped rect of a moving annotation.

    Declaration

    Objective-C

    - (CGRect)screenRectOfMovingAnnotationClosestToPosition:(CGRect)position;

    Swift

    func screenRectOfMovingAnnotationClosest(toPosition position: CGRect) -> CGRect

    Parameters

    position

    the current cgrect position of the annotation.

    Return Value

    the snapped cgrect position of the annotation.

  • Computes the current annotation positions on a given page number.

    Declaration

    Objective-C

    - (void)calculateAnnotationPositionsWithCurrentAnnotType:
                (PTExtendedAnnotType)annotType
                                                AtPageNumber:(int)pageNumber
                                           includePageCenter:
                                               (BOOL)includePageCenter;

    Swift

    func calculateAnnotationPositions(withCurrentAnnotType annotType: PTExtendedAnnotType, atPageNumber pageNumber: Int32, includePageCenter: Bool)

    Parameters

    annotType

    current annotation extended type .

    pageNumber

    page number of the current annotation

    includePageCenter

    weather is should calculate the positon of the page center.

  • Removes all snapping lines.

    Declaration

    Objective-C

    - (void)removeAllSnappingViews;

    Swift

    func removeAllSnappingViews()
  • Displays a menu item when snapping has occured to disable snapping.

    Declaration

    Objective-C

    - (void)showDisableSnappingMenuIfSnappingHasOccurred;

    Swift

    func showDisableSnappingMenuIfSnappingHasOccurred()