protected void Button1_Click(object sender, EventArgs e) { // //SautinSoft.PdfVision v = new SautinSoft.PdfVision(); // ////Specify top and bottom page margins // //v.PageStyle.PageMarginTop.Mm(5f); // //v.PageStyle.PageMarginBottom.Mm(25f); // //string html = GetHtml(); // //byte[] pdfBytes = null; // //v.ImageStyle.HtmlTimeOutForScripts = 0f; // //pdfBytes = v.ConvertHtmlStringToPDFStream(html); // ////show PDF // //if (pdfBytes != null) // //{ // // Response.Buffer = true; // // Response.Clear(); // // Response.ContentType = "application/PDF"; // // //Response.AddHeader("Content-Disposition:", "attachment; filename=Result.pdf"); // // Response.AddHeader("Content-Disposition:", "inline; filename=Result.pdf"); // // Response.BinaryWrite(pdfBytes); // // Response.Flush(); // // Response.End(); // //} ASPXToPDF1.RenderAsPDF("License.pdf"); }
protected void Button_Render_Click(object sender, EventArgs e) { clearAllFields("form1"); Label_INV_Creation_Stat.Visible = false; TextBox_Taxable_Amount.ReadOnly = true; TextBox_Taxable_Amount.BorderStyle = BorderStyle.None; TextBox_Taxable_Amount.BackColor = System.Drawing.Color.Transparent; GridView_Inv_Tax_Comp.Columns[0].Visible = false; //TextBox_Value foreach (GridViewRow gVR in GridView1.Rows) { ((TextBox)gVR.Cells[2].FindControl("TextBox_Qnty")).ReadOnly = true; ((TextBox)gVR.Cells[2].FindControl("TextBox_Qnty")).BackColor = System.Drawing.Color.Transparent; ((TextBox)gVR.Cells[2].FindControl("TextBox_Qnty")).BorderStyle = BorderStyle.None; ((TextBox)gVR.Cells[2].FindControl("TextBox_Unit_Price")).ReadOnly = true; ((TextBox)gVR.Cells[2].FindControl("TextBox_Unit_Price")).BackColor = System.Drawing.Color.Transparent; ((TextBox)gVR.Cells[2].FindControl("TextBox_Unit_Price")).BorderStyle = BorderStyle.None; } foreach (GridViewRow gVR in GridView_Inv_Tax_Comp.Rows) { ((TextBox)gVR.Cells[3].FindControl("TextBox_Value")).ReadOnly = true; ((TextBox)gVR.Cells[3].FindControl("TextBox_Value")).BackColor = System.Drawing.Color.Transparent; ((TextBox)gVR.Cells[3].FindControl("TextBox_Value")).BorderStyle = BorderStyle.None; } Button_Render.Visible = false; Button_Update_Inv.Visible = false; Button_Show_All_Tax_Comp_List.Visible = false; ASPXToPDF1.RenderAsPDF("newFile.pdf"); /* Response.Clear(); * Response.Buffer = true; * Response.AddHeader("content-disposition", * "attachment;filename=GridViewExport.doc"); * Response.Charset = ""; * Response.ContentType = "application/vnd.ms-word "; * StringWriter sw = new StringWriter(); * HtmlTextWriter hw = new HtmlTextWriter(sw); * TextBox_Inv_Date.DataBind(); * TextBox_Inv_Date.RenderControl(hw); * Label_Client_Name.DataBind(); * Label_Client_Name.RenderControl(hw); * /*GridView1.AllowPaging = false; * GridView1.DataSource= * GridView1.DataBind(); * GridView1.RenderControl(hw);*/ /*Response.Output.Write(sw.ToString()); * Response.Flush(); * Response.End();*/ }
/// <summary> /// Export To PDF All Quotation Summary /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnExporttoPDF_Click(object sender, EventArgs e) { try { lblRFQSent.Visible = true; lblRD.Visible = true; lblQRF.Visible = true; lblQD.Visible = true; lblID.Visible = true; lblAF.Visible = true; System.Web.UI.HtmlControls.HtmlTableCell thViewQuotationSent = (System.Web.UI.HtmlControls.HtmlTableCell)RepeaterRfqSent.Controls[0].Controls[0].FindControl("thViewQuotationSent"); thViewQuotationSent.Visible = false; System.Web.UI.HtmlControls.HtmlTableCell thViewQuotation = (System.Web.UI.HtmlControls.HtmlTableCell)RepeaterQtnRcv.Controls[0].Controls[0].FindControl("thViewQuotation"); thViewQuotation.Visible = false; foreach (RepeaterItem item in RepeaterQtnRcv.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { System.Web.UI.HtmlControls.HtmlTableCell tdViewQuotation = (System.Web.UI.HtmlControls.HtmlTableCell)item.FindControl("tdViewQuotation"); ImageButton BtnViewQtnRFQ = (ImageButton)item.FindControl("imgBtnViewQtnRFQ"); BtnViewQtnRFQ.Visible = tdViewQuotation.Visible = false; } } foreach (RepeaterItem item in RepeaterRfqSent.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { System.Web.UI.HtmlControls.HtmlTableCell tdViewQuotationSent = (System.Web.UI.HtmlControls.HtmlTableCell)item.FindControl("tdViewQuotationSent"); ImageButton imgViewQuotationSent = (ImageButton)item.FindControl("imgViewQuotationSent"); imgViewQuotationSent.Visible = tdViewQuotationSent.Visible = false; } } btnExporttoPDF.Visible = false; EO.Pdf.HtmlToPdf.Options.PageSize = new SizeF(17.0f, 17.69f); PdfDocument doc = new PdfDocument(); EO.Pdf.Runtime.AddLicense("p+R2mbbA3bNoqbTC4KFZ7ekDHuio5cGz4aFZpsKetZ9Zl6TNHuig5eUFIPGe" + "tcznH+du5PflEuCG49jjIfewwO/o9dB2tMDAHuig5eUFIPGetZGb566l4Of2" + "GfKetZGbdePt9BDtrNzCnrWfWZekzRfonNzyBBDInbW6yuCwb6y9xtyxdabw" + "+g7kp+rp2g+9RoGkscufdePt9BDtrNzpz+eupeDn9hnyntzCnrWfWZekzQzr" + "peb7z7iJWZekscufWZfA8g/jWev9ARC8W7zTv/vjn5mkBxDxrODz/+ihb6W0" + "s8uud4SOscufWbOz8hfrqO7CnrWfWZekzRrxndz22hnlqJfo8h8="); EO.Pdf.HtmlToPdf.Options.HeaderHtmlFormat = "<div style='text-align:top; font-family:Tahoma; font-size:10px;'></div>"; EO.Pdf.HtmlToPdf.Options.VisibleElementIds = "divMain"; HtmlToPdf.Options.AutoFitX = HtmlToPdfAutoFitMode.ScaleToFit; ASPXToPDF1.RenderAsPDF("QuotationSummary.pdf"); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }