Click here to Skip to main content
15,894,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi here i return my code for creation on pdf file. but it is showing error

my code:
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();
        }
Posted
Updated 19-Jul-11 23:57pm
v2
Comments
OriginalGriff 20-Jul-11 5:58am    
And what error is it showing?
walterhevedeich 20-Jul-11 5:59am    
This document is Top Secret! :laugh:
Sorry but I can't resist.
OriginalGriff 20-Jul-11 6:15am    
Damn! I was hoping he'd post the document instead of the error message! :laugh:

1 solution

If you use an external library, at least tell us what it is. Your best bet is to read the docs and ask on the forums for the product you;re using,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900