Ablafizi Kibiki

Ablafizi Kibiki

  • NA
  • 15
  • 29.6k

save dialog box in asp.net c#

Oct 8 2013 5:11 AM
Hi there!, I can generate a pdf file in asp.net c# using iTextsharp,  but i want client to choose the location and file name instead of the default i provide for them
 here is my code

Document doc = new Document(iTextSharp.text.PageSize.A4);
            PdfWriter wr = PdfWriter.GetInstance(doc, new FileStream(@"C:\mypdf.pdf", FileMode.Create));
            doc.Open();
            int tt = Table1.Rows.Count;
            BtnTaskSave.Text = tt.ToString();
            PdfPTable table = new PdfPTable(2);
            for (int j = 0; j < tt; j++)
            {
                PdfPCell ce = new PdfPCell(new Phrase(Table1.Rows[j].Cells[0].Text));
                table.AddCell(ce);
                PdfPCell ce1 = new PdfPCell(new Phrase(Table1.Rows[j].Cells[1].Text));
                table.AddCell(ce1);
            }
            doc.Add(table);
            doc.Close();

thaks in advance.

Answers (1)