PSPDFTextMarkupAnnotation

Objective-C


@interface PSPDFTextMarkupAnnotation : PSPDFAnnotation

Swift

class TextMarkupAnnotation : Annotation

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.

    Note

    The passed-in PSPDFGlyph instances do not carry information about the page index they are to be inserted at. Use PSPDFAnnotation.pageIndex on the PSPDFTextMarkupAnnotation instance returned from this method to set the appropriate page index.

    Declaration

    Objective-C

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

    Swift

    class func textOverlayAnnotation(with glyphs: [Glyph]?) -> 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.

  • Convenience initializer that creates a text markup 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;

    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 Document to get the marked up content. (Because we actually just write rects, it’s not easy to get the underlying text)

    Declaration

    Objective-C

    @property (readonly) NSString *_Nonnull markedUpString;

    Swift

    var markedUpString: String { get }
  • Convenience initializer that creates a text markup annotation from an array of rects to be marked up.

    • rects: The rects, in PDF coordinates, that are to be marked up.
    • boundingBox: The bounding box for the annotation.
    • pageIndex: The page index the new annotation is on.

    Note

    This method should be called on a concrete subclass, not directly on TextMarkupAnnotation.

    Declaration

    Swift

    public class func textOverlayAnnotation(withRects rects: [CGRect], boundingBox: CGRect, pageIndex: Int) -> `Self`?

    Return Value

    A new markup annotation or nil if rects is empty.