|
The project detailed here shows how to redact or delete text and
images from a document.
The code uses a variety of criteria to determine the items to be
redacted. The most obvious one is an area of interest. As such, we
have examples showing how to redact text or images in a particular
area on a page.
However other criteria are also possible. Other examples show
how to delete specific words from a document or how to select and
delete text based on text font and styling.
The examples cover a variety of ways of selecting what to
remove. You can redact all the text within a rectangle, find a word
or phrase and remove it, remove all text in a particular font, or
delete images which overlap an area. There is also an example of
search and replace.
Two levels of text redaction are provided. The simple approach
removes entire text operators, which is ideal for clearing an area
of a page. The fine approach removes individual characters, which
is more appropriate when removing a name or number from the middle
of a line.
Unlike drawing a black box over the top, the text and images are
removed from the document itself. So they cannot be copied,
extracted or found by searching. Unused fonts can be removed too,
and content shared between pages is copied before it is changed, so
that redacting one page does not affect another.
If you need to sanitize a document or remove personal or
confidential information before sharing it, this is a good place to
start.
|