Write PDF files using .Net
“iText is a library that allows you to generate PDF files on the fly” – using this library, one can easily write PDFs in .Net. To get started, download the library from http://www.lowagie.com/iText/ (or SourceForge.net).
After downloading the .dll file, add it as a reference in your application.
Sample code (C#.Net):
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
//1. Create a document obj.
Document myDoc = new Document(PageSize.A4.Rotate());
//2. Create a writer & stream that will write to the file
PdfWriter.GetInstance(myDoc, new FileStream("Em.pdf", FileMode.Create));
//3. Open document
myDoc.Open();
//4. Write content to the document
myDoc.Add(new Paragraph("Hello World!"));
//5. Close document
myDoc.Close();
}
}
}