GroupDocs.Redaction for .NET 23.8 Release Notes

Major Features

There are the following improvements in this release:

  • Redaction in Arabic document
  • Redact large area of PDF document based on selection

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
REDACTIONNET-423Redaction in Arabic documentBug
REDACTIONNET-425Redact large area of PDF document based on selectionBug

Public API and Backward Incompatible Changes

Redaction in Arabic document

This bugfix allows users to specify right-to-left text direction for ExactPhraseRedaction.

Redact large area of PDF document based on selection

This bugfix resolves a PDF documents issue when you need to redact text, images and annotations for a specific page range or page area.

Public API changes

Class IFixedFormatDocument, defining methods, required for fixed structure formats, such as PDF, has been added to GroupDocs.Redaction.Integration namespace.
Class PageAreaRedaction, that affects text, images and annotations in an area of the page, has been added to GroupDocs.Redaction.Redactions namespace.
Property IsRightToLeft, getting and setting a boolean value to indicate right-to-left languages, have been added to GroupDocs.Redaction.Redactions.ExactPhraseRedaction class.

Usage

The following example demonstrates how to apply ExactPhraseRedaction to an Arabic PDF document.

C#

            using (Redactor redactor = new Redactor("Arabic.pdf"))
            {
                ExactPhraseRedaction red = new ExactPhraseRedaction("أﺑﺠﺪ", new ReplacementOptions("[test]"));
                red.IsRightToLeft = true;
                RedactorChangeLog result = redactor.Apply(red);
                if (result.Status != RedactionStatus.Failed)
                {
                    redactor.Save();
                };
            }

The following example demonstrates how to redact the whole paragraph in a PDF document.

C#

            using (Redactor redactor = new Redactor("LoremIpsum.pdf"))
            {
                RedactorChangeLog result = redactor.Apply(new RegexRedaction("(Lorem(\n|.)+?urna)", new ReplacementOptions(System.Drawing.Color.Red)));
                if (result.Status != RedactionStatus.Failed)
                {
                    redactor.Save();
                };
            }

The following example demonstrates how to apply PageAreaRedaction to the right half of the last page in a PDF document.

C#

            using (Redactor redactor = new Redactor("Sample.pdf"))
            {
                Regex rx = new Regex("urna");
                ReplacementOptions optionsText = new ReplacementOptions("[redarea]");
                optionsText.Filters = new RedactionFilter[] {
                    new PageRangeFilter(PageSeekOrigin.End, 0, 1), // last page
                    new PageAreaFilter(new System.Drawing.Point(300, 0), new System.Drawing.Size(300, 840)) // right half of the page 300x840
                };
                RegionReplacementOptions optionsImg = new RegionReplacementOptions(System.Drawing.Color.Chocolate, new System.Drawing.Size(100, 100));
                RedactorChangeLog result = redactor.Apply(new PageAreaRedaction(rx, optionsText, optionsImg));
                if (result.Status != RedactionStatus.Failed)
                {
                    redactor.Save();
                };
            }