public bool CreatePDF(string path)
{
bool bRet = false;
Document document = new Document();
try
{
PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(path, FileMode.Create));
document.Open();
//document.AddAuthor("author name");
document.AddCreationDate();
iTextSharp.text.Table aTable = new iTextSharp.text.Table(3);
aTable.BorderWidth = 0;
aTable.Cellspacing = 0;
aTable.Cellpadding = 1;
aTable.Width = 100;
aTable.TableFitsPage = true;
Chunk Heading = new Chunk("Data value to be print on the PDF file");
Heading.Font.SetStyle(Font.BOLD);
Heading.Font.Size = 12;
Heading.Font.SetStyle(Font.UNDERLINE);
Cell tblTop = new Cell(Heading);
tblTop.BorderWidth = 0;
tblTop.Colspan = 3;
tblTop.HorizontalAlignment = 1;
aTable.AddCell(tblTop);
Chunk Detail = new Chunk("Data value to be print on the PDF file");
Detail.Font.Size = 10;
Detail.Font.SetStyle(Font.BOLD);
Cell tblHeader = new Cell(Detail);
tblHeader.BorderWidth = 0;
tblHeader.Colspan = 3;
tblHeader.HorizontalAlignment = 1;
aTable.AddCell(tblHeader);
// similarly add cells as much you want.........
document.Add(aTable);
bRet = true;
}
catch (DocumentException de)
{
Response.Write(de.Message);
}
catch (IOException ioe)
{
Response.Write(ioe.Message);
}
document.Close();
//if (bRet)
// Response.Write(path + " has been created");
return bRet;
}
try this..may be help you to generate pdf file.