Implementing a custom encryption / DRM with PDFNet


I need like to implement a custom document encryption system (DRM) using PDFNet.

Encrypted PDFs need be displayed from stream (no local file stored on hard-drive). We also want to control over selected text, copying , bookmarks, annotations, table of contents, thumbnails etc.

How do I get stated with this. I am already up and running the mobile samples :slight_smile:


PDFNet offers couple of ‘quick’ ways to implement custom security / DRM:

a) Implement a custom filter (which you would pass in the call to PDFDoc constructor). With this approach PDF document technically stops being a valid PDF. It does not use Standard security handler and as a result it can’t work as an Acrobat plug-in etc. On the pro side, the method offers a more better protection than DRM based on standard PDF security handler (i.e. the option - b)

Please note that both Android and iOS SDK come with sample code showing how to implement custom filters.

For Android please see: \Samples\PDFViewCtrlDemo\src\com\pdftron\pdfnet\demo\pdfviewctrl\

For iOS please see: PDFNet_iOS\Sample\CustomFilter\

b) Use a custom security handler based on Standard PDF Security handler.

There are couple of ways this could be done. The simplest option is to manually tweak PDF encryption dictionary - as discussed in the following articles:

With PDFNet you also have full control over the viewer … you can disable or limit text selection, copy, annotations, bookmarks, links etc

You can also disable any type of disk caching (for apps that need a high level of security at the expense of speed).

More relevant articles:

Besides above options PDFNet also offers a low-level Cos (that we call ‘SDF’, for Structured Document Format; API that will let you read/write/edit PDF at very low level. This may be useful for some very specialized DRM applications, but is most cases overkill or not required.