PDF password protection via pdf-utils
-
Hello, I'm trying to get a pdf that will not allow any editing. I don't want the user to have to enter a password.
Per the https://jsreport.net/learn/pdf-utils documentation I supplied:
{ "template": { "name": "directoryTemplate", "engine": "pug", "recipeArgs": { "format": "Letter", "marginRight": "0", "marginLeft": "0", "marginTop": "0", "marginBottom": "0" }, "recipe": "chrome-pdf", "pdfPassword": { "ownerPassword": "password", "printing": "high resolution", "modifying": false, "copying": false, "annotating": false, "fillingForms": false, "contentAccessibility": false, "documentAssembly": false } }, "data": { ...snip... } }
This makes the pdf not editable (good!) but it also disallows printing (not good...).
For the "printing" field, I also tried "HighResolution" per the example in the documentation and "highResolution" after poking around in https://github.com/jsreport/jsreport-pdf-utils for a bit (though that looks just like the UI for the studio part).
We have created pdfs via a different platform that are not editable and that are printable so I know it is technically possible and per the listed pdf specification, it's a matter of getting the correct bits set for user access permissions. Given that, are any of these the correct value for the printing field? Am I missing something else to get the correct bits to be set to allow printing but not editing?
We are using the 2.10.0-full version of the docker image.
-
Hi,
thank you for the bug report. Two problems here.
The first is that the enum has values
notAllowed, highResolution, lowResolution
The second problem is that we recently fixed a bug in the password protection which will be part of the next release jsreport 2.11. This should be released in the next few days. In summary, please wait for the 2.11 and usehighResolution
value then.
-
That's great news, we'll keep an eye out for that version!
Thanks for the clarification on what the valid values are, the documentation wasn't clear.