PDF creation using iTextSharp in ASP.Net

This blog will show how to create PDF using iTextSharp in C# .NET

Please download iTextSharp at first from below link.


Give reference of iTextSharp dll in your program

Here is C# code to create PDF using iTextSharp

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;
public partial class pdf_creation : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        Document myDocument = new Document(PageSize.A4.Rotate());
            PdfWriter.GetInstance(myDocument, new FileStream("D:\\Salman.pdf",  FileMode.Create));
            myDocument.Add(new Paragraph("First Pdf File made by Salman using iText"));
        catch (DocumentException de)
        catch (IOException ioe)