您好,这里我返回我的代码,用于创建PDF文件。但它显示错误
我的代码:public void pdf()
{
int i = 0;
// r is for random file names...
Random r = new Random();
i = r.Next(1, 999999999);
string filename = i.ToString() + ".pdf";
//path where to save...
string path = "D:/Test/" + filename;
Document document = new Document();
PdfWriter writer;
writer = PdfWriter.GetInstance(document, new FileStream(path, System.IO.FileMode.Create));
// Set password ...replace mypass with your password .......
writer.SetEncryption(PdfWriter.STRENGTH128BITS, "mypass", null, PdfWriter.AllowCopy);
document.Open();
//document as many properties .. for time begin i am using only one ..
//document.add is to add contant to your file..
document.Add(new Paragraph("This document is Top Secret!"));
document.Close();
}