Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// For complete examples and data files, please go to
//Initialize RedactionPolicy
RedactionPolicy policy = RedactionPolicy.Load(Common.MapSourceFilePath("Documents/Bulk/RedactionPolicy.xml"));
foreach (var fileEntry in Directory.GetFiles(Common.MapSourceFilePath(Inbound_Path)))
using (Document doc = Redactor.Load( fileEntry))
//Apply redaction
RedactionSummary result = doc.RedactWith(policy.Redactions);
// Set output directory path
String resultFolder = result.Status != RedactionStatus.Failed ? Common.MapSourceFilePath(Outbound_Done_Path) : Common.MapSourceFilePath(Outbound_Failed_Path);
// Save the ouput files after applying redactions
using (Stream fileStream = File.Create(Path.Combine(resultFolder, Path.GetFileName(fileEntry))))
doc.Save(fileStream, new SaveOptions() { RasterizeToPDF = false, RedactedFileSuffix = DateTime.Now.ToString() });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.