Remove usage rights in reader with PDFNet?

Q: I’m opening a PDF with PDFNet and I simply need to remove usage
rights for Reader before I save the file. We start out with a reader-
enabled document for client browser Reader-friendly functionality -
but need to end with a Reader usage rights disabled PDF for processing/
printing. I tried the view_prefs.Erase(“Rights”); method I found in
the Google Group

  • which seems to do nothing… Can I simply make some insignificant
    document-level change that will invalidate the usage rights? Any
    suggestions?

A: Acrobat Reader ‘enable rights’ will be removed whenever you re-save
a ‘rights-enabled’ file using PDFNet SDK or any other third party PDF
software.

As a result, I assume that you would like to disable standard PDF
security permissions related to ‘processing/printing’. You can disable
these permissions as shown in EncTest sample project (http://
www.pdftron.com/net/samplecode.html#EncTest).

For example (in C#… VB.NET, C/C++, JAVA is very similar):

PDFNet.Initialize();
PDFDoc doc = new PDFDoc(“my.pdf”);
if (!doc.InitSecurityHandler()) {
Console.WriteLine(“Document authentication error…”);
return;
}

StdSecurityHandler new_handler = new StdSecurityHandler();

// Set a new ‘permission’ password.
new_handler.ChangeMasterPassword(“test”);

// Set Permissions
new_handler.SetPermission (SecurityHandler.Permission.e_print, false);
new_handler.SetPermission
(SecurityHandler.Permission.e_extract_content, false);
new_handler.SetPermission (SecurityHandler.Permission.e_doc_modify,
false); // …etc.

doc.SetSecurityHandler(new_handler);
doc.Save(“secured.pdf”, 0);
doc.Close();