PTSignaturesManager


@interface PTSignaturesManager : NSObject <PTOverridable>

Creates signatures and manages saved ones.

  • The PTSignaturesManager object’s delegate.

    Declaration

    Objective-C

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

    Swift

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

    Declaration

    Objective-C

    @property (nonatomic) BOOL showDefaultSignature;

    Swift

    var showDefaultSignature: Bool { get set }
  • Used to determine the number of saved signatures.

    Declaration

    Objective-C

    - (NSUInteger)numberOfSavedSignatures;

    Swift

    func numberOfSavedSignatures() -> UInt

    Return Value

    the number of saved signatures.

  • The index of the last selected signature.

    Declaration

    Objective-C

    - (NSInteger)lastSelectedSignatureIndex;

    Swift

    func lastSelectedSignatureIndex() -> Int
  • Gets a saved signature.

    Declaration

    Objective-C

    - (nullable PTPDFDoc *)savedSignatureAtIndex:(NSInteger)index;

    Swift

    func savedSignature(at index: Int) -> PTPDFDoc?

    Parameters

    index

    the index number of the saved signature

    Return Value

    the saved signature.

  • Returns the file name of the signature at the given index of the given hight.

    Declaration

    Objective-C

    - (nullable NSString *)fileNameOfSavedSignatureAtIndex:(NSInteger)index;

    Swift

    func fileNameOfSavedSignature(at index: Int) -> String?

    Parameters

    index

    the index number of the saved signature

    Return Value

    the file name of the signature.

  • Returns an image of the signature at the given index of the given hight.

    Declaration

    Objective-C

    - (nullable UIImage *)imageOfSavedSignatureAtIndex:(NSInteger)index
                                                   dpi:(NSUInteger)dpi;

    Swift

    func imageOfSavedSignature(at index: Int, dpi: UInt) -> UIImage?

    Parameters

    index

    The index of the signature.

    dpi

    The DPI to render the image at. (If unsure, start with 72.)

    Return Value

    A rasterized copy of the signature.

  • Returns an image of the signature at the given index of the given hight.

    Declaration

    Objective-C

    - (nullable UIImage *)imageOfSavedSignatureAtIndex:(NSInteger)index
                                                   dpi:(NSUInteger)dpi
                                             thickness:(CGFloat)thickness;

    Swift

    func imageOfSavedSignature(at index: Int, dpi: UInt, thickness: CGFloat) -> UIImage?

    Parameters

    index

    The index of the signature.

    dpi

    The DPI to render the image at. (If unsure, start with 72.)

    thickness

    Renders the signature with a different stroke thickness than that which it has been saved with.

    Return Value

    A rasterized copy of the signature.

  • Returns an image of the signature at the given index of the given hight.

    Declaration

    Objective-C

    - (nullable UIImage *)imageOfDoc:(nullable PTPDFDoc *)doc dpi:(NSUInteger)dpi;

    Swift

    func image(of doc: PTPDFDoc?, dpi: UInt) -> UIImage?

    Parameters

    doc

    The PTPDFDoc object of the signature.

    dpi

    The DPI to render the image at. (If unsure, start with 72.)

    Return Value

    A rasterized copy of the signature.

  • Returns an image of the signature at the given index of the given hight.

    Declaration

    Objective-C

    - (nullable UIImage *)imageOfDoc:(nullable PTPDFDoc *)doc
                                 dpi:(NSUInteger)dpi
                           thickness:(CGFloat)thickness;

    Swift

    func image(of doc: PTPDFDoc?, dpi: UInt, thickness: CGFloat) -> UIImage?

    Parameters

    doc

    The PTPDFDoc object of the signature.

    dpi

    The DPI to render the image at. (If unsure, start with 72.)

    thickness

    Renders the signature with a different stroke thickness than that which it has been saved with.

    Return Value

    A rasterized copy of the signature.

  • Deletes the saved signature

    Declaration

    Objective-C

    - (BOOL)deleteSignatureAtIndex:(NSInteger)index;

    Swift

    func deleteSignature(at index: Int) -> Bool

    Parameters

    index

    the index of the signature to delete

    Return Value

    YES if the signature was successfully deleted; NO otherwise.

  • Reorders the signatures

    Declaration

    Objective-C

    - (BOOL)moveSignatureAtIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex;

    Swift

    func moveSignature(at fromIndex: Int, to toIndex: Int) -> Bool

    Parameters

    fromIndex

    the originating index number of the signature

    toIndex

    the destination index number of the signature

    Return Value

    YES if the signature was successfully moved; NO otherwise.

  • Creates a new saved signature.

    Declaration

    Objective-C

    - (nonnull PTPDFDoc *)createSignature:(nonnull NSMutableArray *)points
                          withStrokeColor:(nonnull UIColor *)strokeColor
                      withStrokeThickness:(CGFloat)thickness
                               withinRect:(CGRect)rect
                            saveSignature:(BOOL)saveSignature;

    Swift

    func createSignature(_ points: NSMutableArray, withStroke strokeColor: UIColor, withStrokeThickness thickness: CGFloat, within rect: CGRect, saveSignature: Bool) -> PTPDFDoc

    Parameters

    points

    A set of FreeHand points.

    strokeColor

    The color of the freehand stroke.

    thickness

    The thickness of the freehand stroke.

    rect

    The bounding rect of the points.

    saveSignature

    YES if the signature shold be saved as the default signature.

    Return Value

    a PDFDoc where page 1 is the signature.

  • Creates a new saved signature.

    Declaration

    Objective-C

    - (nonnull PTPDFDoc *)createSignatureWithImage:(nonnull UIImage *)image
                                              data:(nonnull NSData *)data
                                     saveSignature:(BOOL)saveSignature;

    Swift

    func createSignature(with image: UIImage, data: Data, saveSignature: Bool) -> PTPDFDoc

    Parameters

    image

    The selected image.

    data

    The data of the selected image.

    saveSignature

    YES if the signature shold be saved as the default signature.

    Return Value

    a PDFDoc where page 1 is the signature.

  • Creates a new saved signature.

    Declaration

    Objective-C

    - (nonnull PTPDFDoc *)createSignatureWithText:(nonnull NSString *)text
                                         withFont:(nonnull UIFont *)font
                                  withStrokeColor:(nonnull UIColor *)strokeColor
                                    saveSignature:(BOOL)saveSignature;

    Swift

    func createSignature(withText text: String, with font: UIFont, withStroke strokeColor: UIColor, saveSignature: Bool) -> PTPDFDoc

    Parameters

    text

    The input text.

    font

    The font of the text.

    strokeColor

    The color of the text.

    saveSignature

    YES if the signature shold be saved as the default signature.

    Return Value

    a PDFDoc where page 1 is the signature.