PSPDFWord


@interface PSPDFWord : NSObject <NSCopying, NSSecureCoding>

Represents a word. Formed out of (usually) multiple glyphs.

  • Undocumented

    Declaration

    Objective-C

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

    Declaration

    Objective-C

    
    @interface PSPDFWord : NSObject <NSCopying, NSSecureCoding>
  • Convenience initializer to create a PSPDFWord. The initializer will fail if there are no glyphs in glyphs.

    Declaration

    Objective-C

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

    Swift

    convenience init?(glyphs wordGlyphs: [PSPDFGlyph], frame: CGRect)

    Parameters

    wordGlyphs

    The glyphs that are a part of the text block that is being instantiated.

    frame

    The frame of the workd. Pass in CGRectNull if you want the frame to be calculated from the values in glyphs.

  • Designated initializer. The initializer will fail if the range of text is invalid (NSNotFound for its location/length). Note that the glyphs array will be empty when using this initalizer.

    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 in range.

  • Returns the content of the word (all glyphs merged together)

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSString *_Nonnull stringValue;

    Swift

    var stringValue: String { get }
  • All glyphs merged together in the smallest possible bounding box. As an optimization, only the first and last glyph will be used for frame calculations.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) CGRect frame;

    Swift

    var frame: CGRect { get set }
  • The range of glyphs (in PSPDFTextParser.glyphs) that the receiver is representing. Returns PSPDFInvalidGlyphRange if the receiver does not have any glyphs.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSRange range;

    Swift

    var range: NSRange { get }
  • Set to YES if this is the last word on a textBlock.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL lineBreaker;

    Swift

    var lineBreaker: Bool { get set }
  • Initialize with glyphs.

    Declaration

    Objective-C

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

    Swift

    convenience init(glyphs wordGlyphs: [PSPDFGlyph], pageRotation: UInt)
  • Initialize with word frame.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithFrame:(CGRect)wordFrame
                             pageRotation:(NSUInteger)pageRotation;

    Swift

    convenience init(frame wordFrame: CGRect, pageRotation: UInt)
  • All PSPDFGlyph objects. Frame will be recalculated when glyphs are set.

    Declaration

    Objective-C

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

    Swift

    var glyphs: [PSPDFGlyph] { get set }
  • The page rotation of the page this word is from.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSUInteger pageRotation;

    Swift

    var pageRotation: UInt { get }