PDF Redaction in a Web Browser

Q:
I am looking for a redaction tool /Pdf Viewer which will be part of my Document Management System developed in ASP.Net. I need to apply redaction in document by drawing a rectangular box over confidential text in my document. I have downloaded trial version of PDFTRON and I am integrating in my test application to check Redaction but I did’nt find any demo on how to apply Redaction interactively by drawing rectangle over text, also I am little confused whether I have to use Server SDK or webViewer i.e. are these same or Web Viewer includes Redaction functionality. Also what are licensing options for the above?

A:
In order to redact original PDF document you would use ‘pdftron.PDF.Redactor’ PDFNet Add-on as shown in Redact sample project that comes as part of PDFNet SDK (http://www.pdftron.com/pdfnet/downloads.html). For example:

PDFNet.Initialize();

ArrayList rarr = new ArrayList();

rarr.Add(new Redactor.Redaction(1, new Rect(0, 0, 600, 600), true, “Top Secret”));

rarr.Add(new Redactor.Redaction(2, new Rect(30, 30, 550, 550), true, “Top Secret”));

using (PDFDoc doc = new PDFDoc(“confidential.pdf”)) {

doc.InitSecurityHandler();

Redactor.Appearance app = new Redactor.Appearance();

app.Font = new System.Drawing.Font(“Arial”, 12);

app.PositiveOverlayColor = System.Drawing.Color.Red;

app.NegativeOverlayColor = System.Drawing.Color.WhiteSmoke;

Redactor.Redact(doc, rarr, app);

doc.Save(“redacted.pdf”, SDFDoc.SaveOptions.e_linearized);

}


So to redact a PDF you just pass a collection of rectangles to ‘Redactor.Redact’.

Now to let the user interactively define redaction regions (i.e. draw rects on content) you can use either the native PDF viewer control that comes as part of PDFNet SDK (e.g. PDFView sample) or you can use the WebViewer.

In either case you would either create a custom annotation tool … or perhaps you can simply use built-in annotation tool (so no extra work required). In case you need a custom annotation tool as a desktop app MyPDFView.cs in PDFNet SDK. In case of WebViewer see Annotation related APIs (http://www.pdftron.com/pdfnet/webviewer/demo/html5/doc/index.html) and in case you wont to write a custom annotation (‘WebViewer\html5\AnnotationNotes.txt’). In any case, I would just recommend using built-in rectangle annotations which can be exported to XML string via ‘CoreControls.AnnotationManager SaveAnnotations()’. You would then send the XML string to server where you can load XFDF to FDFDoc (see http://www.pdftron.com/pdfnet/samplecode/FDFTest.cs) extract the list of annotation rectangles and pass them to ‘Redactor.Redact’.

For a relevant post please see:

[WebViewer] PDF / XPS redaction in a web browser:

https://groups.google.com/d/topic/pdfnet-webviewer/jKtzGvbmNpU/discussion

Regarding licensing you should probably apply for it after you sort out technical things (e.g. what exactly component services you need). When you are ready please fill out http://www.pdftron.com/store/oem.htmlwith detailed information and our sales will get back to you with a proposal.