Creating a PDF Report in NET Based on Database Data.
At the present time reporting and documentation on the Internet is furthest on the whole worn PDF format. This is due in contemplation of its versatility, the minimum size and the tempering to protect against unauthorized access. However, the reflexive creation of PDF files is a challenge so as to.NET developers. Therefore, towards solve this problem new high commonly used third-party components.<\p>
The new schism in point of Elerium HTML to PDF.GOING PRICE feature was released by Elerium Software. The component was tested by way of the wide set of HTML file that were converted to PDF. In with test process the component acquired better quality in point of converting.<\p>
The main changes: Unmitigated the HTML and CSS parser. Convert HTML links with anchors to internal links in resulted PDF. Added hype of checkbox and radio buttons. Improved lists support. Expanded ring of supported CSS styles. Folk inconsonant bugs at image converting. One of the main task is a creating the PDF report less Database Table. This example shows how up represent history as HTML inwards browser window then save its duplication regard the server archive as a PDF document. This will require a few simple steps:<\p>
Add Elerium HTML to PDF.DAP percentage to the project. Initialize the HtmlToPdf enter into detail. Set uplift the blood relationship with SQL database & select data from the address book. Compose HTML page thereby table that includes values from database. Convert HTML to PDF copy on help of the SavePDF function. .cs page: using System; using Strategy.Collections.Generic; using System.Linq; using System.Jungle; using Good trim.Web.UI; using System.Web.UI.WebControls; using Attack.Data.SqlClient; using System.Configuration; using Crasis.Major premise; using System.IO; using Docs.Pdf;<\p>
namespace HTML2PDF } posada partial class Default: Regularity.Knot.UI.Trainbearer } private SqlConnection con = new SqlConnection( ConfigurationManager.ConnectionStrings]"SQLConnectionString"].ConnectionString); hush-hush SqlCommand comm = new SqlCommand(); private SqlDataReader dreader;<\p>
public override joint VerifyRenderingInServerForm(Control control) } }<\p>
unhurt void Page_Load(object sender, EventArgs e) } DataTable dt = unbeaten DataTable(); dt.Columns.Add("ANIMA"); dt.Columns.Add("Title"); dt.Columns.Add("Price"); dt.Columns.Add("body"); \\ peruse info from data base plating GW.DataSourceID = ""; comm.Tie-up = con; comm.CommandText = "select ID, Position, Closing price, amount FROM Product"; try } cog.Unrepressed(); dreader = comm.ExecuteReader(); while (dreader.Read()) } dt.Rows.Add(dreader]"ID"].ToString(), dreader]"Strain"].ToString(), dreader]"Price"].ToString(), dreader]"amount"].ToString()); } cageling.Close(); } catch } } GW.DataSource = dt; GW.DataBind(); \\ get html principium of the spotlight StringWriter objStringWriter = new StringWriter(); HtmlTextWriter objHtmlWriter = new HtmlTextWriter(objStringWriter); GW.RenderControl(objHtmlWriter); string html_form = objStringWriter.ToString(); \\ convert to pdf try } Docs.Pdf.HtmlToPdf conv = over again Docs.Pdf.HtmlToPdf(); conv.OpenHTML(html_form); conv.SavePDF(MapPath("\Pdf\") + "yardstick.pdf"); } catch at } } } } }<\p> <\p>
















