In my application, a user can upload a PDF which other users can later view. For my usecase, I need to ensure that the PDFs are not locked or encrypted and can be viewed by any other user.
To do this, I am asking users to upload unlocked PDFs and would like to throw an error if the PDF is locked, before I try to upload to S3.
I haven't found a consensus on what might be the best way to do this, in-browser? Do I try to read the buffer and throw an error if I am unable to? Or is there another performant and efficient way of detecting this?