Why does setting the open password disables the security settings?

PDFNet SDK for C/C++/Java version 5.8.0.

When setting an open password using the SDK on a document that has security restrictions set, e.g. prohibit printing or copying, these settings are ‘lost’ after the password was set.

Workflow:

  1. Open a document with no restrictions using the SDK
  2. Restrict printing
  3. Save
  4. Check:
    1. Printing is disabled in Adobe Reader 10
    2. Printing is disabled in Foxit Reader 5
  5. Now open the same document using the SDK
  6. Set the open password
  7. Save
  8. Check:
    1. Printing is not disabled in Adobe Reader 10. << Error: Printing should be disabled! >>
    2. Printing is disabled in Foxit Reader 5
      Code:

void main(int argc, char argv[])
{
/
***********************************************************************************
The test application demonstrates that if you have a document with printing disabled
and you the set an open password with PDFTron then you can still print the document
with Adobe Reader 10!

If you open the document with Adobe Reader 10 before you set the open password then
printing will be disabled and if you open the document after the open password was
set with other readers such as Foxit Reader 5 the printing will be disabled.
************************************************************************************/

cout << “Start test” << endl << endl;
PDFNet::Initialize();
try
{
{
/************************************************************************************

  • Open ‘No Security.pdf’ a document with no security settings.
  • Disable printing
  • Save as ‘Printing Disabled.pdf’
    /
    PDFDoc doc("./TestFiles/No Security.pdf");
    doc.InitSecurityHandler();
    SecurityHandler secHandler;
    secHandler.SetPermission(SecurityHandler::Permission::e_print, false);
    doc.SetSecurityHandler(secHandler);
    doc.Save("./TestFiles/Output/Printing Disabled.pdf", SDFDoc::e_linearized , NULL);
    /

    If you open ‘Printing Disabled.pdf’ in either Adobe Reader 10 or Foxit Reader 5 the
    printing is disabled as expected.
    /
    }
    {
    /
  • Open ‘Printing Disabled’
  • Set the open password to ‘123’
  • Save as ‘Open Password 123.pdf’
    /
    PDFDoc doc("./TestFiles/Output/Printing Disabled.pdf");
    doc.InitSecurityHandler();
    SecurityHandler secHandler = doc.GetSecurityHandler();
    secHandler.ChangeUserPassword(“123”);
    doc.SetSecurityHandler(secHandler);
    doc.Save("./TestFiles/Output/Open Password 123.pdf", SDFDoc::e_linearized , NULL);
    /

    If you open ‘Open Password 123.pdf’ in Foxit Reader 5 then printing is still disabled
    but if you open it with Adobe Reader 10 then print is no longer disabled!
    ************************************************************************************/
    }
    }
    catch(Common::Exception& e)
    {
    cout << e << endl;
    }
    catch(…)
    {
    cout << “Unknown Exception” << endl;
    }
    PDFNet::Terminate();
    cout << “Test complete” << endl << endl;
    }

Questions:

  1. Why does setting the open password changes the security restrictions?
  2. Why the difference between Adobe and Foxit?
  3. Is there a workaround in the current version of the SDK?
  4. Will this be resolved in a future version of the SDK?