add reference of iTextSharp dll in your project.

you can download iTextsharp dll from

Document document = new Document(PageSize.A4, 50, 50, 25, 25);

// Create a new PdfWriter object, specifying the output stream

var output = new FileStream(Server.MapPath(“MyFirstPDF.pdf”), FileMode.Create);

PdfWriter.GetInstance(document, output);

// Open the Document for writing


… Step 3: Add elements to the document! …

Paragraph welcomeParagraph = new Paragraph(“Hello, World!”);

// Add the Paragraph object to the document


// Close the Document – this saves the document contents to the output stream