Forum Bugs

--disallow-modify and Adobe Reader's error 21

andyt
We've got an issue where if we use --disallow-modify on a PDF, then Adobe Reader behaves a bit odd with it. The document opens fine, but when you go to save it elsewhere using "save as..", the document appears to start writing but then gets "The document could not be saved. There was a problem reading this document (21)". Every other reader seems to work fine but our users cannot switch to a different reader. Is this really Reader implementing the "disallow-modify" feature? I'm doubting that since it's hardly a friendly message plus when I watch Reader with ProcMon, it does start writing the file out, only to stop near the end. Is there perhaps something a bit wrong with the way Prince is applying the disallow-modify behaviour?

Thanks
mikeday
As far as I know, this is an Acrobat bug. It works for me in Acrobat Pro 7 (on Windows), and Adobe Reader 9 (on Linux), but not Adobe Reader X (on Windows).

My suggestion is not to use --disallow-modify, as it cannot entirely prevent modification, but merely discourages it. Perhaps you could ask the users not to modify the PDF files instead?
andyt
OK, thanks for that, we'll see what we can change at this end. I'm surprised that I can't kind any reference to anyone else getting this Error 21 though.
andyt
I've since noticed that perhaps the problem isn't with the --disallow-modify itself, but with the encryption that disallow-modify applies (even when --owner-password and --key-bits haven't been specified). I notice that if I do specify owner-password and key-bits but without disallow-modify, then I get the same error 21 problem when writing the file. Does this change anything? Does everyone get the same problem when trying to encrypt a document and then save it in a current Adobe product?
mikeday
We can reproduce the error here in Adobe Reader, but not Adobe Acrobat Professional. I've logged the bug with Adobe.
rpilkey
We're getting the same problem here. Using any of --disallow-modify, or --encrypt or owner-password causes the file to not be able to be saved from acrobat 9.5.3 or acrobat reader X. You don't even have to modify the file, just open it and Ctrl-S.

The file properties indicate that it can be opened by Acrobat 3.0 and later (40-bit encryption?)

In Acrobat, I can remove security, reset the same security settings, and save it. Then I can open the protected file that was secured by Acrobat in Acrobat or Reader, and save it, even with comments.

I think there is a difference between how princexml is securing the file and how Acrobat is securing it.

Roger
mikeday
Today I made some small adjustments to the way we encrypt PDF files which appear to make Acrobat successfully save the file, instead of failing with "error 21". So perhaps this is the solution to the problem. We will release an updated version of Prince including this change, and see how it goes.
rpilkey
Thanks, that was quick! I will test this when it comes out.

Roger
mikeday
Today we have released Prince 8.1 rev 5, which includes a workaround for the Adobe "error 21" affecting encrypted PDF files. Please let me know if it works. :)
rpilkey
Thanks, we have tested and installed 8.1 rev 5. Users can now save their own copy of a pdf, and mark it up with comments and save it, too.