Sparticuz / node-qpdf2

A Content Preserving transformations on PDFs wrapped around QPDF
MIT License
20 stars 16 forks source link

Show encryption info #30

Closed azymnis closed 1 year ago

azymnis commented 1 year ago

Hello! Thanks for this library.

qpdf allows us to do this:

$ qpdf --show-encryption file.pdf
V = 5
R = 6
P = -4
Has user password: no
Has owner password: yes
User password = 
extract for accessibility: allowed
extract for any purpose: allowed
print low resolution: allowed
print high resolution: allowed
modify document assembly: allowed
modify forms: allowed
modify annotations: allowed
modify other: allowed
modify anything: allowed
stream encryption method: AESv3
string encryption method: AESv3
file encryption method: AESv3

It would be great to wrap this with node-qpdf2 as well

Sparticuz commented 1 year ago

Sure, I've got a prototype built. What are you looking for in this info, just the string output, or do you think it's important to have the string parsed? Might be a little difficult because there are two different ways to split the data in the results, both = and : are used.

azymnis commented 1 year ago

@Sparticuz thank you! I was mostly interested in finding out whether a pdf is encrypted or not. The rest of the information is not as important. I am building an app where the interaction will look like this:

  1. A user uploads a file
  2. If the file is an encrypted pdf we tell that to the user
  3. The user can click on a prompt and enter the file's password
  4. Our app uses that to decrypt the pdf and store the decrypted version

Thanks again for your help

Sparticuz commented 1 year ago

I merged the PR, but i most likely won't be able to cut a new release until tomorrow.

azymnis commented 1 year ago

@Sparticuz thank you and that is completely fine