Javascript to automatically supply password

北城余情 提交于 2019-12-20 05:43:35

问题


I have an application that displays password protected PDFs using iTextSharp.

pdfCopy.SetEncryption(true, "Secretinfo", "Secretinfo", 0);

If the user saves the PDF, the saved copy of the PDF is password protected. Which is great. The problem is it also prompts for password before displaying the PDF on the browser. Which isn't good.

So I'm thinking maybe it's possible to supply the password using javascript just to display it on the browser. It's bad practice but I don't see that I have any other choice. I'm no good at JavaScript. Maybe someone here can help me?

But hey if you have another idea of how to best approach my problem, please do tell!

Here's what I need to happen:

Display the PDF on the browser without it prompting for password. But I need the saved copy to be password protected. No edit, print or copy. Not even view. Unless the user supplies the password.

来源:https://stackoverflow.com/questions/17719629/javascript-to-automatically-supply-password

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!