public class

RedactionAnnotation

extends BaseRectsAnnotation
java.lang.Object
   ↳ com.pspdfkit.annotations.Annotation
     ↳ com.pspdfkit.annotations.BaseRectsAnnotation
       ↳ com.pspdfkit.annotations.RedactionAnnotation

Class Overview

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(int, int, int) 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.

Summary

[Expand]
Inherited Constants
From class com.pspdfkit.annotations.Annotation
[Expand]
Inherited Fields
From class com.pspdfkit.annotations.Annotation
Public Constructors
RedactionAnnotation(int pageIndex, List<RectF> rects)
Creates a new redaction annotation.
Public Methods
int getFillColor()
Returns a fill color associated with this redaction or BLACK if no color is set.
int getOutlineColor()
Returns the color used for the redaction's border in its preview state.
String getOverlayText()
Returns the text that should be displayed at the specified rects when a redaction has been applied.
final AnnotationType getType()
Gets the annotation type of the annotation.
void setOutlineColor(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.
void setOverlayText(String overlayText)
Sets the text that should be displayed at the specified rects when a redaction has been applied.
void setRepeatOverlayText(boolean repeatOverlayText)
Defines whether the overlay text should be drawn only once, or repeated to fill the whole bounding box.
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 updateTransformationProperties(RectF newBoundingBox, RectF oldBoundingBox)
Annotations may override this method to transform their properties (i.e.
[Expand]
Inherited Methods
From class com.pspdfkit.annotations.BaseRectsAnnotation
From class com.pspdfkit.annotations.Annotation
From class java.lang.Object

Public Constructors

public RedactionAnnotation (int pageIndex, List<RectF> rects)

Creates a new redaction annotation.

NOTE: This requires the Redaction component license to use, and will throw an InvalidPSPDFKitLicenseException if used without it.

Parameters
pageIndex Page to which this annotation will be attached to.
rects Rectangles that represent redactions for this annotation.
Throws
InvalidPSPDFKitLicenseException When used without Redaction component.

Public Methods

public int getFillColor ()

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

Returns
  • Color of redaction or BLACK if no color is set.

public 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 RED if none is set.

public 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.

public final AnnotationType getType ()

Gets the annotation type of the annotation.

Returns
  • The type of the annotation. Makes down casting easier.

public void setOutlineColor (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.

public void setOverlayText (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.

public 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.

public 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.

public void updateTransformationProperties (RectF newBoundingBox, 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).