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(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)