PSPDFTextBlock


@interface PSPDFTextBlock : NSObject <NSCopying, NSSecureCoding>

Represents multiple words forming a text block. (e.g. a Column)

  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFTextBlock : NSObject <NSCopying, NSSecureCoding>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFTextBlock : NSObject <NSCopying, NSSecureCoding>
  • Designated initializer to create a text block. The initializer will fail if there are no glyphs in the array.

    Note

    Use CGRectNull to indicate that the frame should be calculated automatically.

    Declaration

    Objective-C

    - (nullable instancetype)initWithGlyphs:(nonnull NSArray<PSPDFGlyph *> *)glyphs
                                      frame:(CGRect)frame
                               pageRotation:(NSUInteger)pageRotation;

    Swift

    init?(glyphs: [PSPDFGlyph], frame: CGRect, pageRotation: UInt)
  • Designated initializer to create a text block. The initializer will fail if there are no glyphs in the array.

    Calculates frame automatically by building the union of all glyph frames.

    Declaration

    Objective-C

    - (nullable instancetype)initWithGlyphs:(nonnull NSArray<PSPDFGlyph *> *)glyphs
                               pageRotation:(NSUInteger)pageRotation;

    Swift

    convenience init?(glyphs: [PSPDFGlyph], pageRotation: UInt)
  • Frame of the text block. Not rotated. - note: Use convertGlyphRectToViewRect: when converting to view coordinates.

    Declaration

    Objective-C

    @property (readonly, nonatomic) CGRect frame;

    Swift

    var frame: CGRect { get }
  • All glyphs of the current text block.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSArray<PSPDFGlyph *> *_Nonnull glyphs;

    Swift

    var glyphs: [PSPDFGlyph] { get }
  • All words of the current text block. Evaluated lazily.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSArray<PSPDFWord *> *_Nonnull words;

    Swift

    var words: [PSPDFWord] { 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 }
  • The page rotation of the page this word is from.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSUInteger pageRotation;

    Swift

    var pageRotation: UInt { get }
  • Compare to another text block.

    Declaration

    Objective-C

    - (BOOL)isEqualToTextBlock:(nonnull PSPDFTextBlock *)otherBlock;

    Swift

    func isEqual(to otherBlock: PSPDFTextBlock) -> Bool