Class RedactionAnnotation

  • All Implemented Interfaces:

    
    public class RedactionAnnotation
    extends BaseRectsAnnotation
                        

    Represents a redaction annotation on the document. The text marked by this annotation will be completely removed once the redaction is applied. To mark text for redaction just place the RedactionAnnotation above the text, you can use getPageTextRects to find the correct bounds for the text. Any glyphs that intersect the redaction bounding box will be redacted, they don't need to be covered completely. Call applyRedactions to apply the redactions persistently.

    NOTE: This requires the Redaction component license to use.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      RedactionAnnotation(int pageIndex, List<RectF> rects) Creates a new redaction annotation.
      RedactionAnnotation(AnnotationPropertyMap properties, boolean markDirty) Intended for internal usage only.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      int getOutlineColor() Returns the color used for the redaction's border in its preview state.
      void setOutlineColor(@ColorInt() int outlineColor) Sets the color used for the redaction's border in its preview state, this color can't be transparent and any alpha information will be removed before applying it.
      String getOverlayText() Returns the text that should be displayed at the specified rects when a redaction has been applied.
      void setOverlayText(@Nullable() String overlayText) Sets the text that should be displayed at the specified rects when a redaction has been applied.
      boolean shouldRepeatOverlayText() Returns false if the overlay text should be drawn only once, or true if it is repeated to fill the whole bounding box.
      void setRepeatOverlayText(boolean repeatOverlayText) Defines whether the overlay text should be drawn only once, or repeated to fill the whole bounding box.
      int getFillColor() Returns a fill color associated with this redaction or Color#BLACK if no color is set.
      final AnnotationType getType() Gets the annotation type of the annotation.
      void updateTransformationProperties(@NonNull() RectF newBoundingBox, @NonNull() RectF oldBoundingBox) Annotations may override this method to transform their properties (i.e.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RedactionAnnotation

        RedactionAnnotation(int pageIndex, List<RectF> rects)
        Creates a new redaction annotation.
        Parameters:
        pageIndex - Page to which this annotation will be attached to.
        rects - Rectangles that represent redactions for this annotation.
      • RedactionAnnotation

        RedactionAnnotation(AnnotationPropertyMap properties, boolean markDirty)
        Intended for internal usage only.
    • Method Detail

      • getOutlineColor

        @ColorInt() int getOutlineColor()

        Returns the color used for the redaction's border in its preview state. Defaults to a red outline if nothing is specified.

        Returns:

        Color of redaction's border or Color#RED if none is set.

      • setOutlineColor

         void setOutlineColor(@ColorInt() int outlineColor)

        Sets the color used for the redaction's border in its preview state, this color can't be transparent and any alpha information will be removed before applying it.

        Parameters:
        outlineColor - Color to use for redaction border.
      • getOverlayText

        @Nullable() String getOverlayText()

        Returns the text that should be displayed at the specified rects when a redaction has been applied. Defaults to null, which means no text will be displayed.

        Returns:

        The text that should be displayed at the specified rects when a redaction has been applied.

      • setOverlayText

         void setOverlayText(@Nullable() String overlayText)

        Sets the text that should be displayed at the specified rects when a redaction has been applied.

        Parameters:
        overlayText - The text that should be displayed when a redaction has been applied, or null so no text is displayed.
      • shouldRepeatOverlayText

         boolean shouldRepeatOverlayText()

        Returns false if the overlay text should be drawn only once, or true if it is repeated to fill the whole bounding box. Defaults to false, which means the text won't be repeated.

        Returns:

        false if the overlay text is only drawn once, true if it is repeated to fill the whole bounding box.

      • setRepeatOverlayText

         void setRepeatOverlayText(boolean repeatOverlayText)

        Defines whether the overlay text should be drawn only once, or repeated to fill the whole bounding box.

        Parameters:
        repeatOverlayText - true to repeat the text across the bounding box, false so the overlay text is only drawn once.
      • getFillColor

        @ColorInt() int getFillColor()

        Returns a fill color associated with this redaction or Color#BLACK if no color is set. Note that alpha channel is not taken into account the exception being Color#TRANSPARENT which allows you remove the fill color all together as long as an overlay text is specified.

        Returns:

        Color of redaction or Color#BLACK if no color is set.

      • getType

        @NonNull() final AnnotationType getType()

        Gets the annotation type of the annotation.

        Returns:

        The type of the annotation. Makes down casting easier.

      • updateTransformationProperties

         void updateTransformationProperties(@NonNull() RectF newBoundingBox, @NonNull() RectF oldBoundingBox)

        Annotations may override this method to transform their properties (i.e. points, rects, sizes) whenever the bounding box of the annotation changed.

        Parameters:
        newBoundingBox - New bounding box of the annotation (in PDF points).
        oldBoundingBox - Old bounding box of the annotation (in PDF points).