PSPDFMarkupAnnotation


@interface PSPDFMarkupAnnotation : PSPDFAnnotation

Base class for Highlight, Underline, StrikeOut and Squiggly annotations. You should never create instances of this class directly. Use one of its subclasses instead.

  • Convenience initializer that creates a markup annotation from glyphs.

    Note

    This method should be called on a subclass, and not on this class directly.

    Declaration

    Objective-C

    + (nullable instancetype)
    textOverlayAnnotationWithGlyphs:(nullable NSArray<PSPDFGlyph *> *)glyphs
                       pageRotation:(NSInteger)pageRotation;

    Swift

    class func textOverlayAnnotation(with glyphs: [PSPDFGlyph]?, pageRotation: Int) -> Self?

    Parameters

    glyphs

    The glyphs from which the markup annotation is to be created. It should have at least one object, otherwise nil is returned.

    pageRotation

    is the rotation property of the PSPDFPageInfo

  • Convenience initializer that creates a text annotation from an array of rects to be marked up.

    Note

    This method should be called on a subclass, and not on this class directly.

    Declaration

    Objective-C

    + (nullable instancetype)textOverlayAnnotationWithRects:
                                 (nonnull NSArray<NSValue *> *)rects
                                                boundingBox:(CGRect)boundingBox
                                                  pageIndex:(NSUInteger)pageIndex;

    Swift

    class func textOverlayAnnotation(withRects rects: [NSValue], boundingBox: CGRect, pageIndex: UInt) -> Self?

    Parameters

    rects

    The rects, in PDF coordinates, that are to be marked up. Must have at least 1 rect, failing which nil is returned.

    boundingBox

    The bounding box for the annotation.

    pageIndex

    The page index the new annotation is on.

    Return Value

    An instance of the markup annotation.

  • Helper that will query the associated PSPDFDocument to get the highlighted content. (Because we actually just write rects, it’s not easy to get the underlying text)

    Declaration

    Objective-C

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

    Swift

    var highlightedString: String { get }