PSPDFTextBlock
@interface PSPDFTextBlock : NSObject <NSCopying, NSSecureCoding>
Represents multiple words forming a text block. (e.g. a Column)
-
Unavailable
Undocumented
Declaration
Objective-C
PSPDF_EMPTY_INIT_UNAVAILABLE
-
Unavailable
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
The text that is contained by the receiver. It is the caller’s responsibility to ensure that the
text
matches the passed inrange
. @frame The frame of the text block, in normalized PDF coordinates. -
Frame of the text block, in normalized PDF coordinates.
Declaration
Objective-C
@property (readonly, nonatomic) CGRect frame;
Swift
var frame: CGRect { get }
-
The range of glyphs (in
PSPDFTextParser.glyphs
) that the receiver is representing.Declaration
Objective-C
@property (readonly, nonatomic) NSRange range;
Swift
var range: NSRange { get }
-
Returns the content of the text block (all words merged together)
Declaration
Objective-C
@property (readonly, copy, nonatomic) 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: PSPDFTextBlock) -> Bool