Q:
I am trying out PDFTron PDFNet to check whether this can be used for PDF Redaction.
I have provide replacement text , replacement font and size to the redact function, however the replaced text appears very small, regardless of the font size provided.
Below code is used for redaction
void Redact(string input, string output, ArrayList rarr,PDFDoc doc) {
Redactor.Appearance app = new Redactor.Appearance();
app.Font = new System.Drawing.Font(“Arial”, 1);
app.Border = false;
Redactor.Redact(doc, rarr, app);
}
A:
The purpose of Redactor is to remove all PDF content within a specified region.
Although Redactor is not intended for text search & replace in PDF ('pdftron.PDF.ContentReplacer’ may better suited for this - http://www.pdftron.com/pdfnet/samplecode.html#ContentReplacer), there is a feature in Redactor class (Redactor.Appearance) that could be used to customize the appearance of the optional redaction overlay (e.g. used to add extra information in the redacted region that confidential info was removed etc).
Within ‘Redactor.Appearance’ you can specify properties such as ‘MinFontSize’ & ‘MaxFontSize’. If you want all text to be of a specific size set both properties to the same value. For example:
…
Redactor.Appearance app = new Redactor.Appearance();
app.MinFontSize = app.MaxFontSize = 18;
app.PositiveOverlayColor = System.Drawing.Color.Red;
app.NegativeOverlayColor = System.Drawing.Color.WhiteSmoke;
Redactor.Redact(doc, redact_region, app);
…