GroupDocs.Redaction for .NET 26.9 is now available. This release removes the System.Drawing.Common dependency from the .NET 6, .NET 8, and .NET 10 packages and improves cross-platform compatibility with Linux and other supported operating systems.

Fixes and enhancements

  • [Enhancement] Migrate away from System.Drawing to enhance cross-platform compatibility. (REDACTIONNET-799)

What’s New?

Version 26.9 completes the migration away from System.Drawing. System.Drawing types have been removed from the public API. The internal code continues to use System.Drawing for document processing only on .NET Framework 4.6.2.

Cross-platform packages without System.Drawing.Common

The .NET 6, .NET 8, and .NET 10 packages no longer depend on System.Drawing.Common. Document processing does not require GDI+ or libgdiplus. The .NET Framework 4.6.2 build still uses the Windows GDI+ stack.

System.Drawing types removed from the public API

Color, point, size, rectangle, and font values now come only from GroupDocs.Redaction.Options.Drawing. Code that still passes System.Drawing.Color, System.Drawing.Point, System.Drawing.Size, System.Drawing.Rectangle, or System.Drawing.Font no longer compiles.

GroupDocs.Redaction.Options.Drawing.Color still exposes named colors such as Color.Black and Color.Blue, plus Color.FromName and Color.FromArgb.

The original member names are the current API again. BoxColor, FillColor, Size, TopLeft, and Rectangle now use the GroupDocs drawing types. The temporary aliases added in 26.6 are obsolete:

Obsolete alias Use instead
ReplacementOptions.BoxFillColor ReplacementOptions.BoxColor
RegionReplacementOptions.AreaFillColor RegionReplacementOptions.FillColor
RegionReplacementOptions.AreaSize RegionReplacementOptions.Size
ImageAreaRedaction.TopLeftPosition ImageAreaRedaction.TopLeft
PageAreaFilter.AreaRectangle PageAreaFilter.Rectangle
TextFragment.BoundingRectangle TextFragment.Rectangle

Public API changes

Removed

  • Public members that accepted or returned System.Drawing types on ReplacementOptions, RegionReplacementOptions, ImageAreaRedaction, PageAreaFilter, TextFragment, and IImageFormatInstance
  • ReplacementOptions(System.Drawing.Color)
  • RegionReplacementOptions constructors that took System.Drawing.Color, System.Drawing.Size, or System.Drawing.Font
  • ImageAreaRedaction(System.Drawing.Point, RegionReplacementOptions)
  • PageAreaFilter(System.Drawing.Point, System.Drawing.Size)
  • TextFragment(string, System.Drawing.Rectangle)
  • IImageFormatInstance.EditArea(System.Drawing.Point, RegionReplacementOptions)

Current API

  • ReplacementOptions.BoxColor and ReplacementOptions(GroupDocs.Redaction.Options.Drawing.Color)
  • RegionReplacementOptions.FillColor, RegionReplacementOptions.Size, and constructors that take GroupDocs.Redaction.Options.Drawing color, size, and font
  • ImageAreaRedaction.TopLeft and ImageAreaRedaction(GroupDocs.Redaction.Options.Drawing.Point, RegionReplacementOptions)
  • PageAreaFilter.Rectangle and PageAreaFilter(GroupDocs.Redaction.Options.Drawing.Point, GroupDocs.Redaction.Options.Drawing.Size)
  • TextFragment.Rectangle and TextFragment(string, GroupDocs.Redaction.Options.Drawing.Rectangle)
  • IImageFormatInstance.EditArea(GroupDocs.Redaction.Options.Drawing.Point, RegionReplacementOptions)

Obsolete

  • ReplacementOptions.BoxFillColor — use ReplacementOptions.BoxColor
  • RegionReplacementOptions.AreaFillColor — use RegionReplacementOptions.FillColor
  • RegionReplacementOptions.AreaSize — use RegionReplacementOptions.Size
  • ImageAreaRedaction.TopLeftPosition — use ImageAreaRedaction.TopLeft
  • PageAreaFilter.AreaRectangle — use PageAreaFilter.Rectangle
  • TextFragment.BoundingRectangle — use TextFragment.Rectangle

Code examples

Draw a colored box over matched text

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();
}

Redact an area of an image

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

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();
}

How to get the update

Learn more