Q: I'm trying to embed PdfView into a Winforms application in order to
provide a restricted viewer for some sensitive documents. I'm using
the samples provided as a basis, but the PdfView that is shown always
has the right-click features and keyboard shortcuts activated. I want
to disable all of this so my users won't be able to save copies of the
file from the viewer, won't be able to print them and won't be able to
copy-paste content either. I don't want to fiddle with basic pdf
security (anyway it doesn't prevent saving copies) since some of the
files i'm displaying are already encrypted.
Is there a simple way to do that, I can't seem to find any decent
example.
-------------
A: We released a new PDFNet SDK update (v.4.8 - http://www.pdftron.com/pdfnet/downloads.html)
that includes some features that will allow you to customize
PDFViewCtrl based on your requirements.
Currently you can override context menus for built-in tools by
overriding OnMouseUp event. For example (in C#):
protected override void OnMouseUp(MouseEventArgs e) {
// One way to override built-in content menu. Replace it with your
own menu?
if (e.Button == MouseButtons.Right) {
MenuItem menuItem = new MenuItem("Print");
menuItem.Click += new EventHandler(OnPrint);
ContextMenu popup = new ContextMenu();
popup.MenuItems.Add(menuItem);
Rect wnd_pos = GetChildWindowPosition();
popup.Show(this, new System.Drawing.Point(e.X+(int)wnd_pos.x1, e.Y+
(int)wnd_pos.y1));
return;
}
base.OnMouseUp(e);
}
Similarly you can override OnKeyUp, OnKeyDown, OnKeyPress and call
the base-class method if you would like to process specific types of
events by the base class.
The extended C# PDFView sample (http://www.pdftron.com/pdfnet/
samplecode.html#PDFView) illustrates various customizations to the
built-in viewer.