Foxit PDF SDK

Public Member Functions | List of all members
foxit::addon::Redaction Class Reference
Inheritance diagram for foxit::addon::Redaction:

## Public Member Functions
| Redaction (const pdf::PDFDoc &document)
| Constructor, from a PDF document object. More...
| Redaction (const Redaction &other)
| Constructor, with another redaction object. More...
| ~Redaction ()
| Destructor.
bool | Apply ()
| Apply redaction in marked areas: remove the text or graphics under marked areas permanently. More...
void | EnableFileStream (const WString &temp_directory_path, ApplyRedactionCallback *apply_redaction_callback)
| Enable file stream for image object during applying. More...
bool | IsEmpty () const
| Check whether current object is empty or not. More...
pdf::annots::Redact | MarkRedactAnnot (const pdf::PDFPage &page, const RectFArray &rects)
| Mark page contents (text object, image object, and path object) which are to be redacted. More...
bool | operator != (const Redaction &other) const
| Not equal operator. More...
Redaction & | operator= (const Redaction &other)
| Assign operator. More...
bool | operator== (const Redaction &other) const
| Equal operator. More...
common::Progressive | StartApply (common::PauseCallback *pause=0)
| Start to apply redaction in marked areas: remove the text or graphics under marked areas permanently. More...
Public Member Functions inherited from foxit::Base
FS_HANDLE | Handle () const
| Get the handle of current object. More...

## Detailed Description

Redacting a PDF file allows user to hide sensitive information while keeping the document's formatting. This class can be used to mark page contents with redact annotations and apply redaction to permanently remove (redact) visible text and images from PDF documents to protect confidential information such as social security numbers.

See also
  pdf::annots::Redact

## Constructor & Destructor Documentation

## ◆ Redaction() [1/2]

foxit::addon::Redaction::Redaction | ( | const pdf::PDFDoc & | document | ) |
| explicit

Constructor, from a PDF document object.

Parameters

  [in] | document | A valid PDF document object.

Note
  If module "Redaction" is not defined in the license information which is used in function common::Library::Initialize, that means user has no right in using redaction related functions and this constructor will throw exception foxit::e_ErrNoRedactionModuleRight.

## ◆ Redaction() [2/2]

foxit::addon::Redaction::Redaction | ( | const Redaction & | other | ) |

Constructor, with another redaction object.

Parameters

  [in] | other | Another redaction object.

## Member Function Documentation

## ◆ Apply()

bool foxit::addon::Redaction::Apply | ( |  | ) |

Apply redaction in marked areas: remove the text or graphics under marked areas permanently.

Once this functions is called, all the marked page content(text object, image object, and path object) in the document will be removed permanently. All the redact annotations which specify marked areas will be removed (with their pop-up annotations) and these marked areas will be filled by the color specified by pdf::annots::Redact::SetApplyFillColor.

Returns
  true means success, while false means failure.

## ◆ EnableFileStream()

void foxit::addon::Redaction::EnableFileStream | ( | const WString & | temp_directory_path,
|  | ApplyRedactionCallback * | apply_redaction_callback
| ) |  |

Enable file stream for image object during applying.

Once this functions is called, the image object stream will be written into the temporary file in the directory which is specified in temp_directory_path. The temporary file must be kept before destroying document and will be automatically deleted during destroying document.

Parameters

  temp_directory_path | The temporary directory path. If it is empty, the temporary directory will be current path default.
  apply_redaction_callback | The callback for applying redaction which is implemented based on callback class addon::ApplyRedactionCallback.

Returns
  None.

## ◆ IsEmpty()

bool foxit::addon::Redaction::IsEmpty | ( |  | ) | const

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
  true means current object is empty, while false means not.

## ◆ MarkRedactAnnot()

pdf::annots::Redact foxit::addon::Redaction::MarkRedactAnnot | ( | const pdf::PDFPage & | page,
|  | const RectFArray & | rects
| ) |  |

Mark page contents (text object, image object, and path object) which are to be redacted.

This function is to add special marks (called redact annotation) to the specified rectangles areas, in order to redact page contents in these areas. Usually, the marked area has two appearance:

- Normal appearance, which is used when the marked area is not interacting with the user. The border color (also known as stroke color) can be set by pdf::annots::Annot::SetBorderColor. The fill color can be set by pdf::annots::Redact::SetFillColor. The opcacity can be set by pdf::annots::Markup::SetOpacity.
- Rollover appearance, which is used when the user moves the cursor into the marked area without pressing the mouse button. The border color and fill color are the same and can be set by pdf::annots::Redact::SetApplyFillColor.

Once function Redaction::Apply is called, all the page contents under these marked area will be removed permanently and these marked areas will keep their rollover appearance all the time.

Parameters

  [in] | page | A PDF page whose content will be marked.
  [in] | rects | Specify areas in the page to be marked. It should not be an empty array. All the input rectangles will be treated as one redact annotation.

Returns
  A redact annotation object (along with a pop-up annotation by default), with default appearance:
  apply fill color = black, border color = red, opacity = 1.0.

## ◆ operator !=()

bool foxit::addon::Redaction::operator != | ( | const Redaction & | other | ) | const

Not equal operator.

Parameters

  [in] | other | Another redaction object. This function will check if current object is not equal to this one.

Returns
  true means not equal, while false means equal.

## ◆ operator=()

Redaction& foxit::addon::Redaction::operator= | ( | const Redaction & | other | ) |

Assign operator.

Parameters

  [in] | other | Another redaction object, whose value would be assigned to current object.

Returns
  Reference to current object itself.

## ◆ operator==()

bool foxit::addon::Redaction::operator== | ( | const Redaction & | other | ) | const

Equal operator.

Parameters

  [in] | other | Another redaction object. This function will check if current object is equal to this one.

Returns
  true means equal, while false means not equal.

## ◆ StartApply()

common::Progressive foxit::addon::Redaction::StartApply | ( | common::PauseCallback * | pause = `0` | ) |

Start to apply redaction in marked areas: remove the text or graphics under marked areas permanently.

This function is similar to function Redaction::Apply, but this function will return a progressive object which can be used to do the redaction progressively.

Parameters

  [in] | pause | A callback object which decides if the applying process should be paused. This can be NULL which means not to pause during the applying process. If this is not NULL, it should be a valid pause object implemented by user. Default value: NULL.

Returns
  A progressive object. Please check the rate of current progress by function common::Progressive::GetRateOfProgress. If the rate is not 100 yet, call function common::Progressive::Continue to continue the progress until the progress is finished.