create sample.pdf inside a folder named PDF
You must create a folder (eg. PDF) inside your application directory
You must put itextsharp.dll(you can find in attachment) inside bin folder you should include following namespaces
using iTextSharp.text; using iTextSharp.text.pdf; using System.IO;
protected void Button1_Click(object sender, EventArgs e) { Document document = new Document(PageSize.B4, 40, 40, 15, 15); string strpath = Server.MapPath("PDF");//You need to create a PDF folder first inside your application directory PdfWriter.GetInstance(document, new FileStream(strpath + @"/" + "Sample.pdf", FileMode.Create));
document.Open(); document.Add(new Paragraph("Sample paragraph")); document.Add(new Paragraph("")); document.Add(new Paragraph("You can many many other things like table, cell etc. etc."));
document.Close(); }
AttachmentsDLL to put inside bin folder (32370-11537-itextsharp.zip)
|
No responses found. Be the first to respond and make money from revenue sharing program.
|