GroupDocs.Redaction for .NET 26.9 Release Notes

Major Features

This release brings the following improvements to GroupDocs.Redaction for .NET:

  • Improved cross-platform compatibility by removing the System.Drawing.Common dependency from the .NET 6, .NET 8, and .NET 10 packages. The .NET Framework 4.6.2 build still uses the Windows GDI+ stack.

This major change resulted in many changes to the public API:

  • Removed System.Drawing types from the public API. Color, point, size, rectangle, and font types are now provided by the GroupDocs.Redaction.Options.Drawing namespace.
  • Restored the original member names as the current API. BoxColor, FillColor, Size, TopLeft, and Rectangle now use GroupDocs.Redaction.Options.Drawing types. The temporary aliases introduced in 26.6 (BoxFillColor, AreaFillColor, AreaSize, TopLeftPosition, AreaRectangle, and BoundingRectangle) are obsolete.

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
REDACTIONNET-799Migrate Away from System.Drawing to Enhance Cross-Platform CompatibilityEnhancement

Public API and Backward Incompatible Changes

Public API changes

Code that still passes System.Drawing.Color, System.Drawing.Point, System.Drawing.Size, System.Drawing.Rectangle, or System.Drawing.Font will no longer compile. Replace them with the corresponding types from the GroupDocs.Redaction.Options.Drawing namespace.

  • Removed public members that accepted or returned System.Drawing types from ReplacementOptions, RegionReplacementOptions, ImageAreaRedaction, PageAreaFilter, TextFragment, and IImageFormatInstance.
  • ReplacementOptions.BoxColor is the current property and uses GroupDocs.Redaction.Options.Drawing.Color. ReplacementOptions.BoxFillColor is obsolete.
  • ReplacementOptions(GroupDocs.Redaction.Options.Drawing.Color) is the colored-box constructor. The System.Drawing.Color constructor was removed.
  • RegionReplacementOptions.FillColor and RegionReplacementOptions.Size are the current properties. AreaFillColor and AreaSize are obsolete.
  • RegionReplacementOptions(GroupDocs.Redaction.Options.Drawing.Color, GroupDocs.Redaction.Options.Drawing.Size) and RegionReplacementOptions(GroupDocs.Redaction.Options.Drawing.Color, GroupDocs.Redaction.Options.Drawing.Font, string) are the current constructors. The System.Drawing constructors were removed.
  • ImageAreaRedaction.TopLeft is the current property and uses GroupDocs.Redaction.Options.Drawing.Point. TopLeftPosition is obsolete.
  • ImageAreaRedaction(GroupDocs.Redaction.Options.Drawing.Point, RegionReplacementOptions) is the current constructor. The System.Drawing.Point constructor was removed.
  • PageAreaFilter.Rectangle is the current property and uses GroupDocs.Redaction.Options.Drawing.Rectangle. AreaRectangle is obsolete.
  • PageAreaFilter(GroupDocs.Redaction.Options.Drawing.Point, GroupDocs.Redaction.Options.Drawing.Size) is the current constructor. The System.Drawing constructor was removed.
  • TextFragment.Rectangle is the current property and uses GroupDocs.Redaction.Options.Drawing.Rectangle. BoundingRectangle is obsolete.
  • TextFragment(string, GroupDocs.Redaction.Options.Drawing.Rectangle) is the current constructor. The System.Drawing.Rectangle constructor was removed.
  • IImageFormatInstance.EditArea accepts GroupDocs.Redaction.Options.Drawing.Point only.
Usage

Use GroupDocs.Redaction.Options.Drawing for a colored box and for an image-area redaction:

using GroupDocs.Redaction.Options.Drawing;
using GroupDocs.Redaction.Redactions;

using (Redactor redactor = new Redactor("sample.docx"))
{
    redactor.Apply(new ExactPhraseRedaction("John Doe", new ReplacementOptions(Color.Black)));
    redactor.Save();
}

using (Redactor redactor = new Redactor("sample.jpg"))
{
    redactor.Apply(new ImageAreaRedaction(
        new Point(516, 311),
        new RegionReplacementOptions(Color.Blue, new Size(170, 35))));
    redactor.Save();
}

If you moved to the temporary names in 26.6, switch back to the original member names:

Obsolete aliasUse instead
ReplacementOptions.BoxFillColorReplacementOptions.BoxColor
RegionReplacementOptions.AreaFillColorRegionReplacementOptions.FillColor
RegionReplacementOptions.AreaSizeRegionReplacementOptions.Size
ImageAreaRedaction.TopLeftPositionImageAreaRedaction.TopLeft
PageAreaFilter.AreaRectanglePageAreaFilter.Rectangle
TextFragment.BoundingRectangleTextFragment.Rectangle