Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenPDF makes no distinctions between reading password vs editing password #35

Closed
bbottema opened this issue Aug 1, 2017 · 5 comments
Closed
Labels

Comments

@bbottema
Copy link

bbottema commented Aug 1, 2017

I have a PDF that is password protected for editing (PDF/A compatible PDF), but can be read without password. If you open Acrobat Reader, go to File -> Properties -> Security -> Show Details.., you can see that there are actually two passwords possible and only for editing it is enabled. Acrobat can even force the PDF to be editable without password, losing the PDF/A compatibility in the process. So either way, a password protected PDF should be viewable in OpenPDF.

OpenPDF detects that the document is encrypted, but since I don't have a password it fails the following check:

public final boolean isOpenedWithFullPermissions() {
  return !encrypted || ownerPasswordUsed;
}

I can open the PDF in other readers just fine as long as I don't enable editing mode. In OpenPDF I would expect something like the following check instead:

public final boolean isOpenedWithFullPermissions() {
  return !encrypted || ownerPasswordUsed || (!pdfRequiresReadingPassword && readonlyMode);
}

If I force this method to return true, it actually is able to read the PDF without issues (this is my current workaround, unfortunately).

@bbottema
Copy link
Author

bbottema commented Aug 1, 2017

Although not the best solution, iText works around it with a property called .unethicalreading (which I think is incorrect for PDF's that have a password for editing, not reading).

@tlxtellef tlxtellef added this to the 1.0.5 milestone Nov 1, 2017
@tlxtellef tlxtellef added the bug label Nov 1, 2017
@tlxtellef tlxtellef modified the milestones: 1.0.5, 1.0.6 Nov 16, 2017
@arthurblake
Copy link
Contributor

arthurblake commented Jul 17, 2018

Would love to see a fix for this in 1.1.1 - IMHO just adding a simple boolean flag such as allowPdfModifyWithoutOwnerPassword with getter/setter to PDFReader (and even defaulting it to true) might be the best way to handle this. I agree that "unethicalreading" is inappropriate as there is really nothing unethical about this. As I understand it, the intent of the owner password was to disallow casual modification, and not as a hard block and certainly not to disable reading entirely.

@ghost
Copy link

ghost commented Jul 17, 2018

Patches welcome.

@arthurblake
Copy link
Contributor

Sure thing. I'll see what I can do.

@arthurblake
Copy link
Contributor

Please see #84

@ghost ghost closed this as completed Jul 17, 2018
@ghost ghost deleted a comment Jul 17, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants