-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add functions to encrypt PDFs for pdf version 1.3 #2959
Conversation
Thanks! I will review this next week, because I'm very busy this week. But no worries, we will get through with this before the 31st ;) |
Sure, no problem. Meanwhile I'll try to figure out why the tests are failing |
Hi @HackbrettXXX any chance of checking this out this week? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please revert the changes to the files in the dist folder. They are only updated on release.
- Please add the encryption options also to the types/index.d.ts file and add a test case types/jspdf.test.ts
- Please also add a unit test with a reference PDF.
- Just to be sure: did you check that every string outside a content stream is encrypted, as well?
For the strings outside the content stream, so far I have tested with most of the examples. Works for all so far except the acroforms one. I will need to work on that. |
Perhaps moving forward the outtputing functions might need a refactor? For instance outputting a dict is something common across many modules, so they should all output using a standard interface, which would allow encapsulation for the encryption part. |
#2750 Implement PDF encryption Version 1 Revision 2 for PDF version 1.3. By default the PDF is not encrypted, encryption can be enabled in the options passed when creating the PDF.
The encryption key for streams and string fields depends on a objectId. Thus, the putStream function now takes in an objectId as one of its options. If encryption is not enabled, then the objectId is not required, hence the API is still backward compatible. If encryption is enabled but the objectId is not passed in then an error is thrown.