Q:
I tested ‘pdftron.PDF.Redactror’ (https://groups.google.com/d/msg/pdfnet-sdk/-xlPEBQcuv8/jyVjHvS24gUJ) which I will use to redact PDF documents in my app.
I now need to integrate this into GUI simular to redaction annotations in Acrobat Pro.
I’m looking at the PDFVIew WPF example and I’m trying to figure out how to just draw a redaction with my mouse so I tried to just change the settool method like so:
CurrentViewer.SetToolMode(PDFViewWPF.ToolMode.e_redaction_create);
What does e_redaction_create do?
Any tips on how to implement the GUI aspect of PDF redaction using PDFTron?
A:
‘PDFViewWPF.ToolMode.e_redaction_create’ was a placeholder for a special type of annotation that would be used to add redaction regions. This option is a no-op since we are started Tools V2 refactoring. We are currently in the process of rewriting WPF control ‘tools’ to be more in-line with our WinRT (http://www.pdftron.com/pdfnet/mobile/windows8_winrt_pdf_library.html). One of the main changes is that the code for forms, annotations, and most of UI handling will be separated in a stand-alone DLL (i.e. Tools.DLL). All licensees also receive source code for ‘Tools.dll’ (similar to our mobile SDKs). This way all UI / tools changes could be easily customized and you can use existing code as a template when developing new tools.
With regards to redaction GUI what are your requirements? Do you need to load a bunch of rectangles (i.e. redaction regions) then let the user edit boxes, then apply the redactions to burn out PDF content? If this is what you are looking for you can download a sample project using the following link:
http://www.pdftron.com/pdfnet/samplecode/data/SamplePDFRedactorGUI.zip
This sample is derived from PDFView sample that comes as part of the SDK and shows how to implement most of the required functions.
One thing to note is that the sample is based on PDFViewCtrl (i.e. a WinForms control) rather than WPF control.
WPF implementation would be along the same lines - you would implement a custom annotation tool. As a starting point please take a look at Start Example, which is part of the PDFViewWPFCS_2010 demo. The sample shows how to switch between document and screen coordinates etc. You can also set the tool mode of the PDFViewWPF to custom, and then do something like what is done in the sample code for this post:
https://groups.google.com/d/msg/pdfnet-sdk/-cStPF6VRnQ/KOVG_eyNKnMJ. The calibration tool stub in the post will draw a rectangle, so it would just be a matter of translating it to page space and redacting.