Click here to Skip to main content
11,704,107 members (56,152 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PDF
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 19-Jul-11 23:54pm
Edited 19-Jul-11 23:57pm
v2
Comments
OriginalGriff at 20-Jul-11 5:58am
   
And what error is it showing?
walterhevedeich at 20-Jul-11 5:59am
   
This document is Top Secret! :laugh:
Sorry but I can't resist.
OriginalGriff at 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
good
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,
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 745
1 OriginalGriff 520
2 Maciej Los 475
3 Andy Lanng 284
4 CPallini 275
0 OriginalGriff 8,784
1 Sergey Alexandrovich Kryukov 7,843
2 CPallini 5,107
3 Maciej Los 4,726
4 Mika Wendelius 3,606


Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 28 May 2015
Copyright © CodeProject, 1999-2015
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