Click here to Skip to main content
13,049,814 members (75,234 online)
Rate this:
Please Sign up or sign in to vote.
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 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!"));
Posted 19-Jul-11 23:54pm
Updated 19-Jul-11 23:57pm
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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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,

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 28 May 2015
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100