PSPDFInkAnnotation


@interface PSPDFInkAnnotation : PSPDFAbstractShapeAnnotation

PDF Ink Annotation. (Free Drawing) Lines are automatically transformed when the boundingBox is changed.

  • Designated initializer. - parameter: lines Array of arrays of boxed PSPDFDrawingPoint.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithLines:
        (nonnull NSArray<NSArray<NSValue *> *> *)lines;

    Swift

    init(lines: [[NSValue]])

    Parameters

    lines

    Array of arrays of boxed PSPDFDrawingPoint.

  • Array of arrays of boxed PSPDFDrawingPoint. Example: annotation.lines = @[@[@(PSPDFDrawingPointMake(CGPointMake(100,100) , 0.5f)), @(PSPDFDrawingPointMake((CGPointMake(100,200), 0.5f)), @(PSPDFDrawingPointMake(CGPointMake(150,300), 0.5f))]]; The intensity values determine the line thickness for natural drawing. @warning: After setting lines, boundingBox will be automatically recalculated.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, null_resettable)
        NSArray<NSArray<NSValue *> *> *lines;

    Swift

    var lines: [[NSValue]]! { get set }
  • The UIBezierPath will be dynamically crated from the lines array.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIBezierPath *_Nonnull bezierPath;

    Swift

    var bezierPath: UIBezierPath { get }
  • Returns YES if lines doesn’t contain any points.

    Declaration

    Objective-C

    @property (readonly, getter=isEmpty, nonatomic) BOOL empty;

    Swift

    var isEmpty: Bool { get }
  • Will return YES if this ink annotation is in the natural drawing style. This is a proprietary extension - other viewer will not be able to detect this.

    Declaration

    Objective-C

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

    Swift

    var naturalDrawingEnabled: Bool { get set }
  • Will return YES if this ink annotation is a PSPDFKit signature. This is a proprietary extension - other viewer will not be able to detect this.

    Declaration

    Objective-C

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

    Swift

    var isSignature: Bool { get set }
  • By default, setting the boundingBox will transform all points in the lines array. Use this setter to manually change the boundingBox without changing lines.

    Declaration

    Objective-C

    - (void)setBoundingBox:(CGRect)boundingBox transformLines:(BOOL)transformLines;

    Swift

    func setBoundingBox(_ boundingBox: CGRect, transformLines: Bool)
  • Generate new line array by applying transform. This is used internally when boundingBox is changed. - returns: Either an NSArray<PSPDFPointArray *> or an NSArray<NSArray<NSValue *> *>.

    Declaration

    Objective-C

    - (nonnull NSArray *)copyLinesByApplyingTransform:(CGAffineTransform)transform;

    Swift

    func copyLines(byApplying transform: CGAffineTransform) -> [Any]

    Return Value

    Either an NSArray <PSPDFPointArray *> or an NSArray <NSArray <NSValue *> *>.