PSPDFFreeTextAnnotation
Objective-C
@interface PSPDFFreeTextAnnotation
: PSPDFAnnotation <PSPDFRotatable, PSPDFOverridable>
Swift
class FreeTextAnnotation : Annotation, Rotatable, Overridable
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 PSPDFFreeTextAnnotationIntent intentType;
Swift
var intent: FreeTextAnnotation.Intent { get set }
-
Starting point for the line if callout is present.
Note
Shortcut for the first point in thepoints
array.As with all annotation properties, post a
.PSPDFAnnotationChanged
notification to propagate changes.Declaration
Objective-C
@property 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 thepoints
array.As with all annotation properties, post a
.PSPDFAnnotationChanged
notification to propagate changes.Declaration
Objective-C
@property CGPoint kneePoint;
Swift
var kneePoint: CGPoint { get set }
-
End point for the line if callout is present.
Note
Shortcut for the third point in thepoints
array.As with all annotation properties, post a
.PSPDFAnnotationChanged
notification to propagate changes.Declaration
Objective-C
@property CGPoint point2;
Swift
var point2: CGPoint { get set }
-
Line end type for the callout.
As with all annotation properties, post a
.PSPDFAnnotationChanged
notification to propagate changes.Declaration
Objective-C
@property PSPDFLineEndType lineEnd;
Swift
var lineEnd: AbstractLineAnnotation.EndType { get set }
-
Defines the inset for the text. Optional, defaults to
UIEdgeInsetsZero
.Note
Only positive inset values are allowed.As with all annotation properties, post a
.PSPDFAnnotationChanged
notification to propagate changes.Declaration
Objective-C
@property 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.
Calling this method while the annotation is selected and has a rotation other than zero is not supported and will not update the view.
-
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 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 YES.
Declaration
Objective-C
@property 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 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 intent of the annotation to the specified value.
Declaration
Objective-C
- (nullable NSArray<PSPDFAnnotationStyleKey> *)convertIntentTypeTo: (PSPDFFreeTextAnnotationIntent)newIntent;
Swift
func convertIntent(to newIntent: FreeTextAnnotation.Intent) -> [String]?
Return Value
A list of property keys that were changed in the process or
nil
if no change was needed.