Copy link to clipboard
Copied
The requirement is to display a password-protected PDF in the browser but to pass the User password programmatically.
I am using the MERN stack and used ADOBE API Tool to create and protect PDF. I want to know can I display this PDF within a webpage (using iframe or any other solution) without the user needing to input the password manually.
The moto here is to - while displaying in the browser, the user should not be prompted to key in the password and hence the password should be supplied by the application, However, if the user downloads the PDF and then tries to open it, he should be prompted to enter the password.
What exactly are you trying to achieve? If the goal is to seamlessly display a PDF file in a browser but prevent the user from downloading it, or more correctly, prevent the user from opening the file after downloading it, you don't need to password protect the file. Instead, you can use Adobe Embed API to display the PDF in the browser and configure it to prevent download. You can see an example at this CodePen.
If this was not your goal, please elaborate on your original message.
Copy link to clipboard
Copied
What exactly are you trying to achieve? If the goal is to seamlessly display a PDF file in a browser but prevent the user from downloading it, or more correctly, prevent the user from opening the file after downloading it, you don't need to password protect the file. Instead, you can use Adobe Embed API to display the PDF in the browser and configure it to prevent download. You can see an example at this CodePen.
If this was not your goal, please elaborate on your original message.
Copy link to clipboard
Copied
I looked at the code on this CodePen. But here the PDF still publicly available via a direct URL link in the .js file.
My aim is to protect the information inside of PDF and only allow the logged-in user to view the PDF. However, if the logged-in user downloads the PDF they should not be able to open it (because of unavailability of password).
I am developing a website where only logged-in users can view the PDF and read the information within it. Since the website will be delivered via a web browser the normal (unprotected) PDF would not be able to secure the information and prevent duplication of PDF.
I require a solution where a protected PDF is delivered to the user's browser and unlock itself on the local machine. Even if downloaded, should require a password to open.
Copy link to clipboard
Copied
Right. That was just my example. You can easily obfuscate the PDF url by having your server convert the PDF to base64 and then using that as your content property. I have an example of that as well if you are interested. Essentially as long as the content is passed as a Promise that resolves as a ByteArray, you can show the PDF.
Copy link to clipboard
Copied
Yes, this helped sorry I didn't read the comments.
Copy link to clipboard
Copied
Stumbled upon this thread thru a google search... sounds like the perfect solution to my issue, which is similar in nature.. earlier I used to convert my pdfs to shockwave flash and that used to do the trick for me but since it got discontinued I had to search for an alternative. I used to be a programmer but not for web-based technologies.. so I can understand things a bit and do tiny customizations to such acquired codes... anyhoo, I copied this code and on execution, it started to do something that looked promising in my custom-built (most code is scavenged though) website that is currently on my local but then failed on the ClientId part... could you help with that... TIA.