PSPDFTextBlock
Objective-C
@interface PSPDFTextBlock : NSObject <NSCopying, NSSecureCoding>
Swift
class TextBlock : NSObject, NSCopying, NSSecureCoding
Represents multiple words forming a text block. (e.g. a Column)
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Unavailable
Not the designated initializer
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Convenience initializer to create a text block. The initializer will fail if there are no glyphs in
glyphs
.Declaration
Objective-C
- (nullable instancetype)initWithGlyphs:(nonnull NSArray<PSPDFGlyph *> *)glyphs frame:(CGRect)frame;
Swift
convenience init?(glyphs: [PSPDFGlyph], frame: CGRect)
Parameters
glyphs
The glyphs that are a part of the text block that is being instantiated.
frame
The frame of the text block, in normalized PDF coordinates. Pass in
CGRectNull
if you want the frame to be calculated from the values inglyphs
. -
Designated initializer to create a text block. The initializer will fail if the range of text is invalid (
NSNotFound
for its location/length). Note that theglyphs
array will be empty when using this initializer.Declaration
Objective-C
- (nullable instancetype)initWithRange:(NSRange)textRange text:(nonnull NSString *)text frame:(CGRect)frame;
Swift
init?(range textRange: NSRange, text: String, frame: CGRect)
Parameters
textRange
The range of text (in
PSPDFTextParser.text
) that the receiver is representing.text
-
Frame of the text block, in normalized PDF coordinates.
Declaration
Objective-C
@property (nonatomic, readonly) CGRect frame;
Swift
var frame: CGRect { get }
-
The range of glyphs (in
PSPDFTextParser.glyphs
) that the receiver is representing.Declaration
Objective-C
@property (nonatomic, readonly) NSRange range;
Swift
var range: NSRange { get }
-
Returns the content of the text block (all words merged together)
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull content;
Swift
var content: String { get }
-
Compare to another text block.
Declaration
Objective-C
- (BOOL)isEqualToTextBlock:(nonnull PSPDFTextBlock *)otherBlock;
Swift
func isEqual(to otherBlock: TextBlock) -> Bool