PSPDFFreeTextAnnotation


@interface PSPDFFreeTextAnnotation : PSPDFAnnotation

PDF FreeText Annotation.

A free text annotation (PDF 1.3) displays text directly on the page. Unlike an ordinary text annotation (see 12.5.6.4, “Text Annotations”), a free text annotation has no open or closed state; instead of being displayed in a pop-up window, the text shall be always visible.

  • Conveniance initializer for normal free text annotations.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithContents:(nonnull NSString *)contents;

    Swift

    init(contents: String)
  • Conveniance initializer for free text callout annotations.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithContents:(nonnull NSString *)contents
                               calloutPoint1:(CGPoint)point1;

    Swift

    init(contents: String, calloutPoint1 point1: CGPoint)
  • The free text annotation intent type. (Optional; PDF 1.6)

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        PSPDFFreeTextAnnotationIntent intentType;

    Swift

    var intentType: PSPDFFreeTextAnnotationIntent { get set }
  • Starting point for the line if callout is present. - note: Shortcut for the first point in the points array.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGPoint point1;

    Swift

    var point1: CGPoint { get set }
  • Knee point (optional) for the line if callout is present. - note: Shortcut for the second point in the points array.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGPoint kneePoint;

    Swift

    var kneePoint: CGPoint { get set }
  • End point for the line if callout is present. - note: Shortcut for the third point in the points array.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGPoint point2;

    Swift

    var point2: CGPoint { get set }
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFFreeTextAnnotation : PSPDFAnnotation
  • Defines the inset for the text. Optional, defaults to UIEdgeInsetsZero. - note: Only positive inset values are allowed.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) UIEdgeInsets innerRectInset;

    Swift

    var innerRectInset: NSEdgeInsets { get set }
  • Resizes the annotation to fit the entire text by increasing or decreasing the height. The width and origin of the annotation are maintained.

    Declaration

    Objective-C

    - (void)sizeToFit;

    Swift

    func sizeToFit()
  • Returns the size of the annotation with respect to the given constraints. If you don’t want to constrain the height or width, use CGFLOAT_MAX for that value. The suggested size does not take the rotation of the annotation into account.

    Declaration

    Objective-C

    - (CGSize)sizeWithConstraints:(CGSize)constraints;

    Swift

    func size(withConstraints constraints: CGSize) -> CGSize
  • Enables automatic vertical resizing. If this property is set to YES, the annotation will adjust its bounding box as the user types in more text. Defaults to YES.

    Declaration

    Objective-C

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

    Swift

    var enableVerticalResizing: Bool { get set }
  • Enables automatic horizontal resizing. If this property is set to YES, the annotation will adjust its bounding box as the user types in more text. Defaults to NO.

    Declaration

    Objective-C

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

    Swift

    var enableHorizontalResizing: Bool { get set }
  • Optionally transforms the boundingBox and re-calculates the text size with it.

    Declaration

    Objective-C

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

    Swift

    func setBoundingBox(_ boundingBox: CGRect, transformSize: Bool)
  • Bounding box for the inner text box if it’s a callout or just a bounding box for the whole annotation The textBoundingBox is defined in PDF coordinates.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGRect textBoundingBox;

    Swift

    var textBoundingBox: CGRect { get set }
  • Set size for the text bounding box (PDF coordinates) for the inner text box if it’s a callout or just a bounding box size for the whole annotation

    Declaration

    Objective-C

    - (void)setTextBoundingBoxSize:(CGSize)size;

    Swift

    func setTextBoundingBox(_ size: CGSize)
  • Converts the annotation to the specified intent type. - returns: A list of property keys that were changed in the process or nil if no change was needed.

    Declaration

    Objective-C

    - (nullable NSArray<NSString *> *)convertToIntentType:
        (PSPDFFreeTextAnnotationIntent)intentType;

    Swift

    func convert(toIntentType intentType: PSPDFFreeTextAnnotationIntent) -> [String]?

    Return Value

    A list of property keys that were changed in the process or nil if no change was needed.