添加密码以保护文档c#
我已经创建了一个pdf文档,我需要使用密码保护该文档添加密码以保护文档c#,c#,asp.net,pdf,passwords,document,C#,Asp.net,Pdf,Passwords,Document,我已经创建了一个pdf文档,我需要使用密码保护该文档 Document document = new Document(PageSize.A4.Rotate(), 10, 10, 10, 10); string pdfFilename = "dbtopdf.pdf"; PdfWriter.GetInstance(document, new FileStream(pdfFilename, FileMode.Create)); PdfPTable
Document document = new Document(PageSize.A4.Rotate(), 10, 10, 10, 10);
string pdfFilename = "dbtopdf.pdf";
PdfWriter.GetInstance(document, new FileStream(pdfFilename, FileMode.Create));
PdfPTable table = new PdfPTable(13);
foreach (abccreation obj in list)
{
"Adding cell here... Not related"
}
document.Open();
document.Add(table);
document.Close();
请问有没有办法在文档中添加密码。因此,当用户试图读取此信息时,它将提示用户输入密码。
我已尝试使用pdf.SecuritySettings.UserPassword=“您的密码”强>
但不知何故,我创建的这个文档不是pdf文件,所以同样的技术无法应用 什么样的文件?任何或特定格式,如
docx
?可能的副本我不知道我创建的文档的格式是什么。或者有没有什么方法可以让我将文档转换成pdf格式?@TienNguyen不同的是,这些方法只能应用于pdf文件,我很难将密码应用于我的文档,我不知道它的格式,但它不是pdf。“我不知道我创建的文档的格式”-嗯,您可以使用iTextSharp,这是一个用于生成PDF的库。因此,我假设您创建了一个PDF。。。