PTAnnotationPasteboard


@interface PTAnnotationPasteboard : NSObject

A PTAnnotationPasteboard instance facilitates annotation copying and pasting on the behalf of a PTPDFViewCtrl or PTToolManager instance. Annotation pasteboards can be shared between multiple PDFViewCtrls, viewers, tabs, etc. to allow annotations to be easily copied between documents.

  • The default annotation pasteboard, which is shared between different PTToolManager instances.

    Declaration

    Objective-C

    @property (class, nonatomic, strong, readonly) PTAnnotationPasteboard *_Nonnull defaultPasteboard;

    Swift

    class var `default`: PTAnnotationPasteboard { get }
  • The source page number of the copied annotation(s). If there are no copied annotations.

    Declaration

    Objective-C

    @property (nonatomic) int sourcePageNumber;

    Swift

    var sourcePageNumber: Int32 { get set }
  • The annotations copied into the pasteboard. If there are no copied annotations, the value is nil.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSArray<PTAnnot *> *annotations;

    Swift

    var annotations: [PTAnnot]? { get }
  • Copies the specified annotations to the pasteboard. *

    • - parameter: annotations The annotations to be copied. *
    • - parameter: pdfViewCtrl The PDFViewCtrl containing the annotations’ document. *
    • - parameter: completion The block to execute after the annotations have been copied. You may specifiy
    • nil for this parameter.

    Declaration

    Objective-C

    - (void)copyAnnotations:(nonnull NSArray<PTAnnot *> *)annotations
            withPDFViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl
             fromPageNumber:(int)pageNumber
                 completion:(void (^_Nullable)(void))completion;

    Swift

    func copyAnnotations(_ annotations: [PTAnnot], with pdfViewCtrl: PTPDFViewCtrl, fromPageNumber pageNumber: Int32) async
  • Pastes the pasteboard’s copied annotations on the specified page number and page-coordinate location of the PTPDFViewCtrl instance.

    Declaration

    Objective-C

    - (void)pasteAnnotationsOnPageNumber:(int)pageNumber
                             atPagePoint:(nonnull PTPDFPoint *)pagePoint
                         withPDFViewCtrl:(nonnull PTPDFViewCtrl *)pdfViewCtrl
                              completion:
                                  (void (^_Nullable)(NSArray<PTAnnot *> *_Nullable,
                                                     NSError *_Nullable))completion;

    Swift

    func pasteAnnotations(onPageNumber pageNumber: Int32, atPagePoint pagePoint: PTPDFPoint, with pdfViewCtrl: PTPDFViewCtrl) async throws -> [PTAnnot]

    Parameters

    pageNumber

    The page number on which to paste the annotations.

    pagePoint

    The page-coordinates location at which to paste the annotations.

    pdfViewCtrl

    The PDFViewCtrl to which the annotations will be pasted.

    completion

    The block to execute after the annotations have been pasted. The pasted annotations are passed to the block on success, or an NSError object is passed in the case of an error. You may specify nil for this parameter.

  • Pastes the pasteboard’s copied annotations on the specified page number and page-coordinate location of the PTPDFViewCtrl instance.

    Declaration

    Objective-C

    - (void)pasteAnnotationsOnPageNumber:(int)pageNumber
                             atPagePoint:(nonnull PTPDFPoint *)pagePoint
                         withToolManager:(nonnull PTToolManager *)toolManager
                              completion:
                                  (void (^_Nullable)(NSArray<PTAnnot *> *_Nullable,
                                                     NSError *_Nullable))completion;

    Swift

    func pasteAnnotations(onPageNumber pageNumber: Int32, atPagePoint pagePoint: PTPDFPoint, with toolManager: PTToolManager) async throws -> [PTAnnot]

    Parameters

    pageNumber

    The page number on which to paste the annotations.

    pagePoint

    The page-coordinates location at which to paste the annotations.

    toolManager

    The tool manager to whose PTPDFViewCtrl the annotations will be pasted.

    completion

    The block to execute after the annotations have been pasted. The pasted annotations are passed to the block on success, or an NSError object is passed in the case of an error. You may specify nil for this parameter.

  • Clears the pasteboard of all copied annotations.

    Declaration

    Objective-C

    - (void)clear;

    Swift

    func clear()