Guidance on Functions for True Redaction in Aspose.Total

Hello Aspose Support,

We need to perform true, irreversible redaction across Word (DOC/DOCX) and PDF using Aspose.Total — not just masking, but fully deleting sensitive text and metadata so nothing remains searchable or recoverable.

Could you confirm:

  • Which built-in functions/APIs exist for full redaction (text/content, annotations, embedded objects, metadata)?
  • Any best-practice samples or recommended patterns for applying and verifying these redactions?

Thanks,
Ashiq

@ashiqshanavas

Hello Ashiq,

To achieve true, irreversible redaction in Aspose.Total for both Word and PDF documents, follow these steps:

Cause: It is essential to redact sensitive information to protect privacy and comply with data protection regulations.

Solution: Utilize the following built-in functions and APIs for effective redaction:

  1. For PDF Redaction:

    • Use the PdfContentEditor class to remove text and images by specifying the areas to redact and applying the changes.
    • The RedactionAnnotation class allows you to create redaction annotations for specific areas of the PDF.
  2. For Word Redaction:

    • The Document class provides methods to find and replace sensitive text. Use Range.Replace to remove specific text.
    • To ensure metadata is also redacted, use the Document.RemoveAllProperties method to clear any document properties that may contain sensitive information.
  3. Annotations and Embedded Objects:

    • For both formats, ensure to remove any annotations or embedded objects that may contain sensitive data. In PDF, iterate through the annotations and remove them using the Annotations collection.
  4. Metadata Removal:

    • In Word, use the Document.RemoveAllProperties method to clear metadata.
    • In PDF, use the PdfDocumentInfo class to access and clear metadata.

Best Practices:

  • Always create a backup of your documents before performing redactions.
  • After redaction, verify the document by searching for the sensitive text to ensure it has been completely removed.
  • Consider using a test document to validate your redaction process before applying it to sensitive documents.

Next Steps: Here’s a minimal code example for redacting text in a PDF:

using Aspose.Pdf;
using Aspose.Pdf.Annotations;

// Load the PDF document
Document pdfDocument = new Document("input.pdf");

// Create a redaction annotation
RedactionAnnotation redaction = new RedactionAnnotation(pdfDocument.Pages[1], new Rectangle(100, 100, 200, 200), "Redacted");
pdfDocument.Pages[1].Annotations.Add(redaction);

// Apply the redaction
redaction.Apply();

// Save the document
pdfDocument.Save("output.pdf");

And for Word:

using Aspose.Words;

// Load the document
Document doc = new Document("input.docx");

// Remove sensitive text
doc.Range.Replace("sensitive text", "", new FindReplaceOptions());

// Remove all properties
doc.RemoveAllProperties();

// Save the document
doc.Save("output.docx");

Please let me know if this information helps! If you have any further questions or need more examples, feel free to ask. I’m here to assist you.

@ashiqshanavas

1). You may use Aspose.PDF for .NET to achieve redaction using the RedactionAnnotation class. This allows you to specify a region of a page that you want to redact.
e.g.,

using (var document = new Aspose.Pdf.Document("input.pdf"))
{
    var annot = new Aspose.Pdf.Annotations.RedactionAnnotation(document.Pages[1], new Aspose.Pdf.Rectangle(200, 500, 300, 600));
    annot.FillColor = Aspose.Pdf.Color.Green;
    annot.BorderColor = Aspose.Pdf.Color.Yellow;
    annot.Color = Aspose.Pdf.Color.Blue;
    annot.OverlayText = "REDACTED";
    annot.TextAlignment = Aspose.Pdf.HorizontalAlignment.Center;
    annot.Repeat = true;
    document.Pages[1].Annotations.Add(annot);
    annot.Redact();
    document.Save("RedactPage_out.pdf");
}

2). For redacting contents in a Word document (DOC/DOCX), you may try using Find/Replace options provided by Aspose.Words. See the document with examples for your reference: Find and Replace in C#|Aspose.Words for .NET

Moreover, to give you better guidance and complete details, my colleagues from Aspose.Words and Aspose.PDF teams will assist you soon. @alexey.noskov, @asad.ali FYI.

@ashiqshanavas I am afraid, there is no built-in method for making redactions in MS Word documents using Aspose.Words. I am not sure this is possible to achieve in MS Word documents, you can replace content in the document with some dummy content and fill it with black background.