protected void PDf() { dt1 = DAL.GetAllData(productID, pdvID, UserID); ProductInformation.InnerText = "Product Information-Version" + versionName; //DataListProductInformation.DataSource = dt1.Tables[]; //DataListProductInformation.DataBind(); AuditTrails.InnerText="Audit Trails-Version" + versionName; DataListAuditTrails.DataSource = dt1.Tables[1]; DataListAuditTrails.DataBind(); Comments.InnerText = "Comments-Version" + versionName; DataListComments.DataSource = dt1.Tables[2]; DataListComments.DataBind(); SupportDocuments.InnerText = "Support Documents-Version" + versionName; DataListSupportDocuments.DataSource = dt1.Tables[3]; DataListSupportDocuments.DataBind(); ArtworkDocuments.InnerText = "Artwork Documents-Version" + versionName; DataListArtworkDocuments.DataSource = dt1.Tables[4]; DataListArtworkDocuments.DataBind(); GPRReports.InnerText = "GPR Report-Version" + versionName; DataListGPRReports.DataSource = dt1.Tables[5]; DataListGPRReports.DataBind(); Annotations.InnerText = "Annotations-Version" + versionName; DataListAnnotations.DataSource = dt1.Tables[6]; DataListAnnotations.DataBind(); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); textStyle.ForeColor = Color.Blue; hw.WriteLine(Statename);//here im adding div id hw.EnterStyle(textStyle, HtmlTextWriterTag.Div);//and adding color to div Statename.InnerText = "State-Version" + versionName; DataListStatename.DataSource = dt1.Tables[0]; DataListStatename.DataBind(); //hw.ExitStyle(textStyle, HtmlTextWriterTag.Div); bindpdf.RenderControl(hw); StringReader sr = new StringReader(sw.ToString()); Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f); HTMLWorker htmlparser = new HTMLWorker(pdfDoc); PdfWriter.GetInstance(pdfDoc, Response.OutputStream); pdfDoc.Open(); htmlparser.Parse(sr); pdfDoc.Close(); Response.Write(pdfDoc); Response.End(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)