# Redaction Class

> Associates an object with its location on a page of a PDF document.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.4.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Redaction
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/llms.txt

```cpp
class Redaction : Annotation
```

**Namespace:** `datalogics_interface`

**Inherits from:** [`Annotation`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Annotation.md)

## Description

Associates an object with its location on a page of a PDF document.

A redaction occludes some part of a document.

**Uses types:** [`AnnotationFlags`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/AnnotationFlags.md), [`Color`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md), [`Form`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Form.md), [`HorizontalAlignment`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/HorizontalAlignment.md), [`Quad`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Quad.md), [`Rect`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Rect.md)

## Constructors

### Redaction

```cpp
datalogics_interface::Redaction::Redaction(Page &page, const std::vector< Quad > &regions)
```

*constructor*

**Parameters**

- `page` ([`Page &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Page.md)): The page where the redaction is placed.
- `regions` ([`const std::vector< Quad > &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Quad.md)): Quadrilateral regions specifying the redaction bounds.

Create a new Redaction annotation with default properties.

## Methods

### clear_interior_color

```cpp
void datalogics_interface::Annotation::clear_interior_color()
```

**Returns:** `void`

Clear the interior color.

### generate_appearance

```cpp
virtual std::unique_ptr< Form > datalogics_interface::Annotation::generate_appearance() const
```

**Returns:** [`std::unique_ptr< Form >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Form.md)

A Form representing the visual appearance, or null if the appearance could not be generated.

Generate a new appearance stream with the current annotation properties.

The resulting Form can then be used to set the annotation's appearance, such as by calling SetNormalAppearance.

### get_align

```cpp
HorizontalAlignment datalogics_interface::Redaction::get_align() const
```

**Returns:** [`HorizontalAlignment`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/HorizontalAlignment.md)

Horiziontal Alignment

Get the horizontal alignment for the redaction text.

### get_annotation_feature_level

```cpp
virtual double datalogics_interface::Annotation::get_annotation_feature_level() const
```

**Returns:** `double`

The minimum PDF version level (e.g. 1.3, 1.4, or 1.5).

The minimum PDF version necessary to support the features used in this annotation.

### get_border_color

```cpp
Color datalogics_interface::Redaction::get_border_color() const
```

**Returns:** [`Color`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)

Color used for the "normal" border.

Get the color used as the "normal" border.

### get_color

```cpp
Color datalogics_interface::Annotation::get_color() const
```

**Returns:** [`Color`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)

The annotation's color.

The color of the annotation.

### get_contents

```cpp
std::string datalogics_interface::Annotation::get_contents() const
```

**Returns:** `std::string`

The annotation's text contents.

The text contents of the annotation.

The text to be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation's contents in human-readable form.

### get_draw_border

```cpp
bool datalogics_interface::Redaction::get_draw_border() const
```

**Returns:** `bool`

boolean value of Draw Border Option If true, border will be drawn in Normal appearance in specified color, If false, no border will be drawn in Normal Appearance.

Get Draw Border option

This option will be true by default in the Brief Initializer, and the border drawn will be in the specified color. It will also be true by default in the Extended initializer, and will draw the border in the specified border color

### get_fill_color

```cpp
Color datalogics_interface::Redaction::get_fill_color() const
```

**Returns:** [`Color`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)

Color used to fill the "normal" appearance area.

Get the color used to fill the "normal" appearance area.

### get_fill_normal

```cpp
bool datalogics_interface::Redaction::get_fill_normal() const
```

**Returns:** `bool`

boolean value of Fill Normal Appearance Option If true, the Normal Appearance will show as filled with the fill color and opacity, If false, Normal Appearance areas will not be filled.

Get Fill Normal Appearance option

This option will be false by default in the Brief Initializer. It will be true by default in the Extended initializer, and will fill the area in the specified fill color and opacity.

### get_fill_opacity

```cpp
double datalogics_interface::Redaction::get_fill_opacity() const
```

**Returns:** `double`

Opacity applied to the fill color in "normal" appearance.

Get the opacity applied to the fill color in "normal" appearance.

### get_fill_redacted

```cpp
bool datalogics_interface::Redaction::get_fill_redacted() const
```

**Returns:** `bool`

boolean value of Fill redacted Appearance Option If true, the Redacted Appearance will show as filled with the specfied color. If false, Redacted Appearance areas will not be filled (They will be left white).

Get Fill Redacted Appearance option

This option will be true by default in the Brief Initializer, and will fill with the color specified It will be true by default in the Extended initializer, and will draw the border in the specified color.

### get_flags

```cpp
AnnotationFlags datalogics_interface::Annotation::get_flags() const
```

**Returns:** [`AnnotationFlags`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/AnnotationFlags.md)

The annotation's flags.

The flags for the annotation.

### get_font_face

```cpp
std::string datalogics_interface::Redaction::get_font_face() const
```

**Returns:** `std::string`

current Font face

Get Font face for the text

### get_font_size

```cpp
double datalogics_interface::Redaction::get_font_size() const
```

**Returns:** `double`

current font size

Get font size for the text;

### get_interior_color

```cpp
std::unique_ptr< Color > datalogics_interface::Annotation::get_interior_color() const
```

**Returns:** [`std::unique_ptr< Color >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)

The interior fill color, or null if no interior color is set.

The interior color with which to fill the annotation's rectangle or circle.

The color of the border itself can be retrieved from Annotation.Color.

### get_internal_color

```cpp
Color datalogics_interface::Redaction::get_internal_color() const
```

**Returns:** [`Color`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)

Color used for the replacement.

Get the color used as the replacement background.

### get_normal_appearance

```cpp
std::unique_ptr< Form > datalogics_interface::Annotation::get_normal_appearance() const
```

**Returns:** [`std::unique_ptr< Form >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Form.md)

A Form representing the annotation's normal appearance, or null if no normal appearance has been set.

The normal appearance of the annotation, represented as a Form XObject.

### get_note

```cpp
std::string datalogics_interface::Redaction::get_note() const
```

**Returns:** `std::string`

Note text

Get the text string to be used as the Popup contents

### get_opacity

```cpp
double datalogics_interface::Annotation::get_opacity() const
```

**Returns:** `double`

The opacity value for this annotation.

The constant opacity value used in painting a Markup annotation.

Opacity is a range from 0.0 (fully transparent) to 1.0 (fully opaque).

### get_overlay_text

```cpp
std::string datalogics_interface::Redaction::get_overlay_text() const
```

**Returns:** `std::string`

the overlay text of the redaction

Get the optional overlay text of the redaction.

### get_page_no

```cpp
int datalogics_interface::Redaction::get_page_no() const
```

**Returns:** `int`

base zero page number

Get the page number where the redaction occurs.

### get_quads

```cpp
std::vector< Quad > datalogics_interface::Redaction::get_quads() const
```

**Returns:** [`std::vector< Quad >`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Quad.md)

A vector of CQuad objects for the redaction.

A list of quads to mark. Each quad encompasses a word or group of contiguous words in the text underlying the annotation.

### get_rect

```cpp
Rect datalogics_interface::Annotation::get_rect() const
```

**Returns:** [`Rect`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Rect.md)

The annotation's bounding rectangle in user space coordinates.

The size and location of the annotation on its page.

### get_repeat

```cpp
bool datalogics_interface::Redaction::get_repeat() const
```

**Returns:** `bool`

repeat value

Get the repeat value

### get_scale_to_fit

```cpp
bool datalogics_interface::Redaction::get_scale_to_fit() const
```

**Returns:** `bool`

Scale To Fit value

Get the ScaleToFit value

### get_subtype

```cpp
std::string datalogics_interface::Annotation::get_subtype() const
```

**Returns:** `std::string`

The subtype string (e.g. "Circle", "Square", "Line").

The annotation's subtype.

### get_text_color

```cpp
Color datalogics_interface::Redaction::get_text_color() const
```

**Returns:** [`Color`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)

Color used for the overlay text.

Get the color used for the overlay text.

### get_title

```cpp
std::string datalogics_interface::Annotation::get_title() const
```

**Returns:** `std::string`

The title string.

The title of the annotation.

### has_rich_text_data

```cpp
bool datalogics_interface::Annotation::has_rich_text_data() const
```

**Returns:** `bool`

true if the annotation contains Rich Text String content.

Checks the annotation for Rich Text String content (PDFReference 1.7 Section 8.6.2). Annotations that contain Rich Text String content and do not have a normal appearance set will not be visible when rendering the page.

### operator==

```cpp
bool datalogics_interface::Annotation::operator==(const Annotation &other) const
```

**Parameters**

- `other` ([`const Annotation &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Annotation.md)): The annotation to compare with this annotation.

**Returns:** `bool`

true if the two annotations are equal.

Test annotations for equality (if they are the same annotation).

### set_align

```cpp
void datalogics_interface::Redaction::set_align(HorizontalAlignment align)
```

**Parameters**

- `align` ([`HorizontalAlignment`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/HorizontalAlignment.md)): desired Horiziontal alignment

**Returns:** `void`

Sets the horizontal alignment for the redaction text.

### set_annotation_feature_level

```cpp
virtual void datalogics_interface::Annotation::set_annotation_feature_level(double level)
```

**Parameters**

- `level` (`double`): The target PDF version level. Features requiring a higher version will be removed.

**Returns:** `void`

Removes features not supported in the supplied version number.

### set_border_color

```cpp
void datalogics_interface::Redaction::set_border_color(const Color &color)
```

**Parameters**

- `color` ([`const Color &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)): The color of the border when the annotation is displayed in the page prior to application of redactions.

**Returns:** `void`

Set the color used as the "normal" border.

### set_color

```cpp
void datalogics_interface::Annotation::set_color(const Color &color)
```

**Parameters**

- `color` ([`const Color &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)): The new color to set.

**Returns:** `void`

The color of the annotation.

### set_contents

```cpp
void datalogics_interface::Annotation::set_contents(const std::string &contents)
```

**Parameters**

- `contents` (`const std::string &`): The new text contents.

**Returns:** `void`

The text contents of the annotation.

The text to be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation's contents in human-readable form.

### set_draw_border

```cpp
void datalogics_interface::Redaction::set_draw_border(bool value)
```

**Parameters**

- `value` (`bool`): boolean value to set Draw Border Option If true, border will be drawn in Normal appearance in specified color, If false, no border will be drawn in Normal Appearance.

**Returns:** `void`

Set Draw Border option

### set_fill_color

```cpp
void datalogics_interface::Redaction::set_fill_color(const Color &color, double opacity)
```

**Parameters**

- `color` ([`const Color &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)): The color which will fill the annotation when it is viewed in the "normal" or pre-redacted appearance.
- `opacity` (`double`): The amount of opacity to apply to the fill color. If this value is zero, not color will be seen. If it is 1.0, then the underlying content of the unredacted document will not be visible.

**Returns:** `void`

Set the color used to fill the "normal" appearance.

### set_fill_normal

```cpp
void datalogics_interface::Redaction::set_fill_normal(bool value)
```

**Parameters**

- `value` (`bool`): boolean value to set Draw Border Option If true, the Normal Appearance will show as filled with the fill color and opacity, If false, Normal Appearance areas will not be filled.

**Returns:** `void`

Set Fill Normal Appearance option

### set_fill_redacted

```cpp
void datalogics_interface::Redaction::set_fill_redacted(bool value)
```

**Parameters**

- `value` (`bool`): boolean value to set Draw Border Option If true, the Redacted Appearance will show as filled with the specfied, If false, Redacted Appearance areas will not be filled (They will be left white).

**Returns:** `void`

Set Fill Redacted Appearance option

### set_flags

```cpp
void datalogics_interface::Annotation::set_flags(AnnotationFlags flags)
```

**Parameters**

- `flags` ([`AnnotationFlags`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/AnnotationFlags.md)): The new annotation flags to set.

**Returns:** `void`

The flags for the annotation.

### set_font_face

```cpp
void datalogics_interface::Redaction::set_font_face(const std::string &name)
```

**Parameters**

- `name` (`const std::string &`): UTF-8 name of font to use for type. if omitted, "Helvetica" will be used.

**Returns:** `void`

Set Font face for the text

### set_font_size

```cpp
void datalogics_interface::Redaction::set_font_size(double size)
```

**Parameters**

- `size` (`double`): Size to draw overlay type at. if set to zero, 10.0 point type will be drawn.

**Returns:** `void`

Set font size for text

### set_interior_color

```cpp
void datalogics_interface::Annotation::set_interior_color(const Color &color)
```

**Parameters**

- `color` ([`const Color &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)): The new interior fill color. Pass null to remove the interior color.

**Returns:** `void`

The interior color with which to fill the annotation's rectangle or circle.

Only RGB colors are allowed.

The color of the border itself can be retrieved from Annotation.Color.

### set_internal_color

```cpp
void datalogics_interface::Redaction::set_internal_color(const Color &color)
```

**Parameters**

- `color` ([`const Color &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)): The color of the redaction mark. This color is also used as the fill color when generating the replacement form for this redaction mark. The replacement form is the content that will be placed on the page when this mark is applied and the underlying content is removed.

**Returns:** `void`

Set the color used as the replacement background.

### set_normal_appearance

```cpp
void datalogics_interface::Annotation::set_normal_appearance(Form &form)
```

**Parameters**

- `form` ([`Form &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Form.md)): The Form to use as the annotation's normal appearance.

**Returns:** `void`

The normal appearance of the annotation, represented as a Form XObject.

### set_note

```cpp
void datalogics_interface::Redaction::set_note(const std::string &text)
```

**Parameters**

- `text` (`const std::string &`): Contents to use on the popup comments box.

**Returns:** `void`

Set the text string to be used as the Popup Contents

### set_opacity

```cpp
void datalogics_interface::Annotation::set_opacity(double opacity)
```

**Parameters**

- `opacity` (`double`): The new opacity value to set.

**Returns:** `void`

The constant opacity value used in painting a Markup annotation.

Opacity is a range from 0.0 (fully transparent) to 1.0 (fully opaque).

### set_overlay_text

```cpp
void datalogics_interface::Redaction::set_overlay_text(const std::string &text)
```

**Parameters**

- `text` (`const std::string &`): UTF-8 text to be written over redaction.

**Returns:** `void`

Set the optional overlay text of the redaction.

### set_page_no

```cpp
void datalogics_interface::Redaction::set_page_no(int page_no)
```

**Parameters**

- `page_no` (`int`): Base zero page number

**Returns:** `void`

Sets the page number where the redaction occurs.

### set_quads

```cpp
void datalogics_interface::Redaction::set_quads(const std::vector< Quad > &quads)
```

**Parameters**

- `quads` ([`const std::vector< Quad > &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Quad.md)): std::vector of Quads

**Returns:** `void`

A list of quads to mark. Each quad encompasses a word or group of contiguous words in the text underlying the annotation.

### set_rect

```cpp
void datalogics_interface::Annotation::set_rect(const Rect &rect)
```

**Parameters**

- `rect` ([`const Rect &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/struct/Rect.md)): The new bounding rectangle in user space coordinates.

**Returns:** `void`

The size and location of the annotation on its page.

### set_repeat

```cpp
void datalogics_interface::Redaction::set_repeat(bool value)
```

**Parameters**

- `value` (`bool`): True will repeat fill string, false will display string only once.

**Returns:** `void`

Set the repeat value

### set_scale_to_fit

```cpp
void datalogics_interface::Redaction::set_scale_to_fit(bool value)
```

**Parameters**

- `value` (`bool`): True will scale text down to fit into area, false will not.

**Returns:** `void`

Set the ScaleToFit value

### set_text_color

```cpp
void datalogics_interface::Redaction::set_text_color(const Color &color)
```

**Parameters**

- `color` ([`const Color &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)): The color of the text when the annotation is displayed as redacted, or when the redactions are applied.

**Returns:** `void`

Set the color used for the overlay text.

### set_title

```cpp
void datalogics_interface::Annotation::set_title(const std::string &title)
```

**Parameters**

- `title` (`const std::string &`): The new title string.

**Returns:** `void`

The title of the annotation.

### to_string

```cpp
std::string datalogics_interface::Annotation::to_string() const
```

**Returns:** `std::string`

A string describing this annotation, including its type and rectangle.

Returns a string representation of this annotation.

### try_as

```cpp
T * datalogics_interface::Annotation::try_as()
```

**Parameters**

- (unnamed) (`typename T`)

**Returns:** `T *`

Attempt to downcast this annotation to a derived type. Returns a pointer to the derived type, or nullptr if the type doesn't match.

### try_as

```cpp
const T * datalogics_interface::Annotation::try_as() const
```

**Parameters**

- (unnamed) (`typename T`)

**Returns:** `const T *`

Const overload of try_as(). Returns a const pointer, or nullptr.
