How to genetate PDF file using C#.Net

For generating PDF file using c# application follow the instruction  :

1) fist open your VS-2010
2) Add reference to it "itextsharp";
3) download this file from here;
4) after downloading  you have to add this as a reference
5) now add namspace like :
           
         using iTextSharp.text;
            using iTextSharp.text.pdf;

6)now write bellow code in form load event

private void Form1_Load(object sender, EventArgs e)
{
            string str = @"||  Jay Hanumna  -  Jay Madi ||   _  Nirav daraniya";
            string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/nirav1.pdf";
            Document dc = new Document();
            FileStream fs = File.Create(path);
            PdfWriter.GetInstance(dc, fs);
            dc.Open();
            dc.Add(new Paragraph("Jay hanuman - Jay madi"+str));
            dc.Close();
 }


7)  Now run your application and show result.............

Download Code : PDF Creator in c#.net
See Also :
  Follow Me On Facebok


--/\/ir@\/  <(.'.)>

Comments

  1. You can also generate PDF file in C# with Aspose.PDF for .NET Library. This Library offers sample codes of many other features for PDF file that developers can use in their APIs.

    ReplyDelete

Post a Comment

Popular posts from this blog

How to make and use web service in Microsoft Dynamics Navision.

How to use Format function in Microsoft Dynamics Navision.

How to create simple report in Microsoft Dynamics Navision.