Dear sir/ mam
I want create .pdf file with the help of store procudure in sql server. How we can create????
Thanks & Regards
Suraj bhoir
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
suraj Bhoir147 reputationPosted Aug 22, 2017, 10:47 PM EDT
Manikandan MurugesanRank #300 · 8.4K reputationPosted Aug 22, 2017, 10:54 PM EDT
Manikandan MurugesanRank #300 · 8.4K reputationPosted Aug 22, 2017, 10:43 PM EDT
Ankit SharmaRank #141 · 16.1K reputationPosted Aug 23, 2017, 2:09 AM EDT
Ravi Kiran ChanduriRank #1,159 · 1.6K reputationPosted Aug 26, 2017, 10:20 PM EDT
Purvesh Sangani46 reputationPosted Sep 19, 2017, 10:23 PM EDT
{
for (int i = 0; i < Grv.Columns.Count; i++)
{
if ((Convert.ToString(Grv.Columns[i].HeaderText) == "Edit") || (Convert.ToString(Grv.Columns[i].HeaderText) == "Delete"))
{
Grv.Columns[i].Visible = false;
}
}
System.Web.HttpContext.Current.Response.ContentType = "application/pdf";
System.Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + PdfName + ".pdf");
System.Web.HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
Grv.AllowPaging = false;
Grv.AllowPaging = false;
Grv.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A2, 7f, 7f, 7f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, System.Web.HttpContext.Current.Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
System.Web.HttpContext.Current.Response.Write(pdfDoc);
System.Web.HttpContext.Current.Response.End();
}