# Class: Redactor

## PDFNet. Redactor

#### new Redactor()

  PDF Redactor is a separately licensable Add-on that offers options to remove (not just covering or obscuring) content within a region of PDF. With printed pages, redaction involves blacking-out or cutting-out areas of the printed page. With electronic documents that use formats such as PDF, redaction typically involves removing sensitive content within documents for safe distribution to courts, patent and government institutions, the media, customers, vendors or any other audience with restricted access to the content.

  The redaction process in PDFNet consists of two steps:

  a) Content identification: A user applies redact annotations that specify the pieces or regions of content that should be removed. The content for redaction can be identified either interactively (e.g. using 'pdftron.PDF.PDFViewCtrl' as shown in PDFView sample) or programmatically (e.g. using 'pdftron.PDF.TextSearch' or 'pdftron.PDF.TextExtractor'). Up until the next step is performed, the user can see, move and redefine these annotations. b) Content removal: Using 'pdftron.PDF.Redactor.Redact()' the user instructs PDFNet to apply the redact regions, after which the content in the area specified by the redact annotations is removed. The redaction function includes number of options to control the style of the redaction overlay (including color, text, font, border, transparency, etc.).

  PDFTron Redactor makes sure that if a portion of an image, text, or vector graphics is contained in a redaction region, that portion of the image or path data is destroyed and is not simply hidden with clipping or image masks. PDFNet API can also be used to review and remove metadata and other content that can exist in a PDF document, including XML Forms Architecture (XFA) content and Extensible Metadata Platform (XMP) content.

### Methods

#### <static> redact(doc, red_arr [, appearance] [, ext_neg_mode] [, page_coord_sys])

  Apply the redactions specified in the array red_arr to the PDFDoc doc.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `doc` | PDFNet.PDFDoc |  |  | the document to redact
  `red_arr` | Array.<PDFNet.Redactor> |  |  | an array of redaction objects specifying the regions to redact.
  `appearance` | PDFNet.RedactionAppearance | <optional> |  | optional parameter used to customize the appearance of the redaction overlay. To create an appearance object, create an empty javascript object {} and add entries containing values to it. The following entries are handled by redact:
      app.redaction_overlay = boolean
      If redaction_overlay is set to true, redactor will draw an overlay
      covering all redacted regions. The rest of properties in the
      appearance object defines visual properties of the overlay.
      If false the overlay region will not be drawn.
      Defaults to true.

      app.positive_overlay_color = ColorPt object
      positive_overlay_color defines the overlay background color in RGB color space for positive redactions.
      Defaults to white (PDFNet.ColorPt(1, 1, 1, 0));

      app.negative_overlay_color = ColorPt object
      negative_overlay_color defines the overlay background color in RGB color space for negative redactions.
      Defaults to white (PDFNet.ColorPt(1, 1, 1, 0));

      app.border = boolean
      border specifies if the overlay will be surrounded by a border.
      Defaults to true.

      app.font = Font object
      font specifies the font used to represent the text in the overlay.
      Defaults to true.

      app.min_font_size = int
      min_font_size specifies the minimum font size used to represent the text in the overlay
      Defaults to 2.

      app.max_font_size = int
      max_font_size specifies the maximum font size used to represent the text in the overlay
      Defaults to 24.

      app.text_color = ColorPt object
      text_color specifies the color used to paint the text in the overlay (in RGB).
      Defaults to dark green (PDFNet.ColorPt(0, 0.5, 0, 0));

      app.horiz_text_alignment = int
      horiz_text_alignment specifies the horizontal text alignment in the overlay:
        align<0  -> text will be left aligned.
        align==0 -> text will be center aligned.
        align>0  -> text will be right aligned.
      Defaults to -1.

      app.vert_text_alignment = int
      vert_text_alignment specifies the vertical text alignment in the overlay:
        align<0  -> text will be top aligned.
        align==0 -> text will be center aligned.
        align>0  -> text will be bottom aligned.
      Defaults to 1.

      app.show_redacted_content_regions = boolean
      show_redacted_content_regions specifies whether an overlay should be drawn in place of
      the redacted content. This option can be used to indicate the areas where the content
      was removed from without revealing the content itself. Defaults to false. Uses
      RedactedContentColor as a fill color.
      Defaults to false.

      app.redacted_content_color = ColorPt object
      Specifies the color used to paint the regions where content was removed.
      Only useful when ShowRedactedContentRegions == true.
      Defaults to gray (PDFNet.ColorPt(0.3, 0.3, 0.3, 0)).
  `ext_neg_mode` | Boolean | <optional> | true | if true, negative redactions expand beyond the page to remove content from other pages in the document. if false, the redaction will be localized to the given page.
  `page_coord_sys` | Boolean | <optional> | true | if true, redaction coordinates are relative to the lower-left corner of the page, otherwise the redaction coordinates are defined in PDF user coordinate system (which may or may not coincide with page coordinates).

#### <static> redactionCopy(other)

  Copy Constructor

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `other` | PDFNet.Redaction |

  ##### Returns:

  A promise that resolves to an object of type: "Redaction"

  Type
    PDFNet.Redaction

#### <static> redactionCreate(page_num, bbox, negative, text)

  Constructor

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `page_num` | number |
  `bbox` | PDFNet.Rect |
  `negative` | boolean |
  `text` | string |

  ##### Returns:

  A promise that resolves to an object of type: "Redaction"

  Type
    PDFNet.Redaction

#### <static> redactionDestroy(redaction)

  Destructor

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `redaction` | PDFNet.Redaction |

#### Search results