GroupDocs.Redaction for .NET 19.3 Release Notes

Major Features

There are the following improvements in this release:

  • Support for raster image formats and image region redactions 
  • Ability to specify a set of redaction rules (policy) in XML file
  • Improved information concerning redaction application status

Full List of Issues Covering all Changes in this Release

KeySummaryCategory
REDACTIONNET-115Add support for image formats and region redactionsFeature
REDACTIONNET-6Implement Configurable RedactionFeature
REDACTIONNET-144Redesign redaction reportingImprovement

Public API and Backward Incompatible Changes

Implement Configurable Redaction

Implement mechanism to configure redactions in XML and apply them to any document as a single redaction profile.

Public API changes

Class RedactionPolicy has been added to GroupDocs.Redaction.Configurationnamespace.
Method Load(System.String) has been added to GroupDocs.Redaction.Configuration.RedactionPolicy class.
Method Load(System.IO.Stream)  has been added to GroupDocs.Redaction.Configuration.RedactionPolicyclass.
Property Redaction[] Redactionshas been added to GroupDocs.Redaction.Configuration.RedactionPolicy class.

Usecase

This example shows how to use RedactionPolicy class:

C#

RedactionPolicy policy = RedactionPolicy.Load("RedactionPolicy.xml");
foreach (var fileEntry in Directory.GetFileNames("C:\\Inbound")) 
{
    using (Document doc = Redactor.Load(Path.Combine("C:\\Inbound\\", fileEntry)))
	{
    	RedactionSummary result = doc.RedactWith(policy.Redactions);
        String resultFolder = result.Status != RedactionStatus.Failed ? "C:\\Outbound\\Done\\" : "C:\\Outbound\\Failed\\";
		using (Stream fileStream = File.Open(Path.Combine(resultFolder, fileEntry), FileMode.Open, FileAccess.ReadWrite))
   		{
      		doc.Save(fileStream, new SaveOptions() { RasterizeToPDF = false, RedactedFileSuffix = DateTime.Now.ToString() });
      		fileStream.Close();
   		}        
	}
}   

Support for image formats and region redactions

Added support for image formats and region redactions.

Public API changes

Value ImageArea has been added to GroupDocs.Redaction.Redactions.RedactionType enum.

Class RegionReplacementOptions has been added to GroupDocs.Redaction.Redactionsnamespace.
Property System.Drawing.Color FillColor has been added to GroupDocs.Redaction.Redactions.RegionReplacementOptions class.
Property System.Drawing.Size Size has been added to GroupDocs.Redaction.Redactions.RegionReplacementOptions class.

Interface IImageFormatInstance has been added to GroupDocs.Redaction.Integration namespace.
Method EditArea(System.Drawing.Point, RegionReplacementOptions) has been added to GroupDocs.Redaction.Integration.IImageFormatInstance interface.

Class ImageAreaRedaction inheriting from Redaction class has been added to GroupDocs.Redaction.Redactions namespace.
Method EditArea has been added to GroupDocs.Redaction.Redactions.ImageAreaRedaction class as an implementation of GroupDocs.Redaction.Integration.IImageFormatInstance interface.
Property RegionReplacementOptions Options  has been added to GroupDocs.Redaction.Redactions.ImageAreaRedaction class.
Property System.Drawing.Point TopLeft has been added  to GroupDocs.Redaction.Redactions.ImageAreaRedaction class.

Usecase

This example shows how to use ImageAreaRedaction class:

C#

using (Document doc = Redactor.Load("D:\\test.jpg"))
{
   System.Drawing.Point samplePoint = new System.Drawing.Point(516, 311);
   System.Drawing.Size sampleSize = new System.Drawing.Size(170, 35);
   RedactionSummary result = doc.RedactWith(new ImageAreaRedaction(samplePoint,
                new RegionReplacementOptions(System.Drawing.Color.Blue, sampleSize)));
   if (result.Status != RedactionStatus.Failed)
   {
      doc.Save();
   };
}

Redesign redaction reporting

Refactor/redesign RedactionResult to reflect at least following options:

  • Redaction ran without errors, but was rejected by user.
  • Redaction could not run because it is not applicable to this type of files.
Public API changes

Constant String RejectionMessage has been added to GroupDocs.Redaction.Integration.DocumentFormatInstance class.

Enum RedactionStatus has been added to GroupDocs.Redactionnamespace.
Value Applied has been added to GroupDocs.Redaction.RedactionStatus enum.
Value PartiallyApplied has been added to GroupDocs.Redaction.RedactionStatus enum.
Value Skipped has been added to GroupDocs.Redaction.RedactionStatus enum.
Value Failed has been added to GroupDocs.Redaction.RedactionStatus enum.

Class RedactionLogEntry has been added to GroupDocs.Redactionnamespace.
Property RedactionResult Result  has been added to GroupDocs.Redaction.RedactionLogEntryclass.
Property Redaction Redaction has been added to GroupDocs.Redaction.RedactionLogEntryclass.

Property RedactionStatus Status has been added to GroupDocs.Redaction.RedactionSummary class.
Property Systrem.Boolean Success has been declared warning-level OBSOLETE in GroupDocs.Redaction.RedactionSummary class.

Property RedactionStatus Status has been added to GroupDocs.Redaction.RedactionResult class.
Property Systrem.Boolean Success has been declared warning-level OBSOLETE in GroupDocs.Redaction.RedactionResult class.
Public constructor of GroupDocs.Redaction.RedactionResult class has been declared private and is no longer available to users.
Static factory method Successful()  has been added to GroupDocs.Redaction.RedactionResult class.
Static factory method Skipped(System.String)  has been added to GroupDocs.Redaction.RedactionResult class.
Static factory method Partial(System.String)  has been added to GroupDocs.Redaction.RedactionResult class..
Static factory method Failed(System.String)  has been added to GroupDocs.Redaction.RedactionResult class.

Usecase

Instead of RedactionSummary.Success or RedactionResult.Success, declared as obsolete, users have to use corresponding Status property. This example shows how to use Status property:

C#

RedactionSummary summary = doc.redactWith(...);
if (summary.Status != RedactionStatus.Applied)
{
	for (int i = 0; i < summary.RedactionLog.Count; i++)
	{
		RedactionLogEngtry logEntry = summary.RedactionLog[i];
    	if (logEntry.Result.Status != RedactionStatus.Applied)
        {
			Console.WriteLine("{0} status is {1}, details: {2}", 
				logEntry.Redaction.GetType().Name, // Dump/analyze redaction settings here, if needed
				logEntry.Result.Status, 
				logEntry.Result.ErrorMessage);
		}
	}
}

© Aspose Pty Ltd 2001-2022. All Rights Reserved.