RedactorApply Method (RedactionPolicy)
Applies a redaction policy to the document.

Namespace: GroupDocs.Redaction
Assembly: GroupDocs.Redaction (in GroupDocs.Redaction.dll) Version: 21.9
Syntax
public RedactorChangeLog Apply(
	RedactionPolicy policy
)

Parameters

policy
Type: GroupDocs.RedactionRedactionPolicy
Redaction policy

Return Value

Type: RedactorChangeLog
Success or failure and error message in this case
Examples

The following example demonstrates how to apply a redaction policy to all files within a given inbound folder, and save to one of outbound folders - for successfully updated files and for failed ones.

C#
RedactionPolicy policy = RedactionPolicy.Load("RedactionPolicy.xml");
foreach (var fileEntry in Directory.GetFileNames("C:\\Inbound")) 
{
     using (Redactor redactor = new Redactor(Path.Combine("C:\\Inbound\\", fileEntry)))
     {
             RedactorChangeLog result = redactor.Apply(policy);
             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))
            {
               redactor.Save(fileStream, new RasterizationOptions() { Enabled = false });
            }        
     }
}
See Also