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.Drawingto 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.Drawingtypes onReplacementOptions,RegionReplacementOptions,ImageAreaRedaction,PageAreaFilter,TextFragment, andIImageFormatInstance ReplacementOptions(System.Drawing.Color)RegionReplacementOptionsconstructors that tookSystem.Drawing.Color,System.Drawing.Size, orSystem.Drawing.FontImageAreaRedaction(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.BoxColorandReplacementOptions(GroupDocs.Redaction.Options.Drawing.Color)RegionReplacementOptions.FillColor,RegionReplacementOptions.Size, and constructors that takeGroupDocs.Redaction.Options.Drawingcolor, size, and fontImageAreaRedaction.TopLeftandImageAreaRedaction(GroupDocs.Redaction.Options.Drawing.Point, RegionReplacementOptions)PageAreaFilter.RectangleandPageAreaFilter(GroupDocs.Redaction.Options.Drawing.Point, GroupDocs.Redaction.Options.Drawing.Size)TextFragment.RectangleandTextFragment(string, GroupDocs.Redaction.Options.Drawing.Rectangle)IImageFormatInstance.EditArea(GroupDocs.Redaction.Options.Drawing.Point, RegionReplacementOptions)
Obsolete
ReplacementOptions.BoxFillColor— useReplacementOptions.BoxColorRegionReplacementOptions.AreaFillColor— useRegionReplacementOptions.FillColorRegionReplacementOptions.AreaSize— useRegionReplacementOptions.SizeImageAreaRedaction.TopLeftPosition— useImageAreaRedaction.TopLeftPageAreaFilter.AreaRectangle— usePageAreaFilter.RectangleTextFragment.BoundingRectangle— useTextFragment.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
- NuGet – Upgrade to the latest
GroupDocs.Redaction for .NETpackage via NuGet - Direct Download – Download GroupDocs.Redaction assemblies from the GroupDocs.Redaction for .NET 26.9 page