PSPDFFreeTextAnnotation


@interface PSPDFFreeTextAnnotation : PSPDFAnnotation <PSPDFRotatable>

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.

  • Convenience initializer for normal free text annotations.

    Declaration

    Objective-C

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

    Swift

    init(contents: String)
  • Convenience 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, atomic) 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, atomic) 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, atomic) 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, atomic) CGPoint point2;

    Swift

    var point2: CGPoint { get set }
  • Undocumented

    Declaration

    Objective-C

    @property (atomic) PSPDFLineEndType lineEnd

    Swift

    var lineEnd: PSPDFLineEndType { get set }
  • Defines the inset for the text. Optional, defaults to UIEdgeInsetsZero.

    Note

    Only positive inset values are allowed.

    Declaration

    Objective-C

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

    Swift

    var innerRectInset: UIEdgeInsets { 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, atomic) 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, atomic) 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, atomic) 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.

    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.

  • The anti-clockwise angle of the annotation relative to the page, in degrees. The only supported values are 0, 90, 180, and 270. Defaults to 0.

    Declaration

    Objective-C

    @property (assign, readwrite, atomic) NSUInteger rotation;

    Swift

    var rotation: UInt { get set }