| PDF Duo .Net is a converting component for use in | | | | "<br><i>HTML table Example</i>";try |
| ASP.NET (VB, C# etc.) and enables to convert HTML | | | | {conv.OpenHTML(html);conv.SavePDF(MapPath("~ |
| to PDF. The main class HtmlToPdf provides several | | | | Reports/") + pdf); |
| methods and properties to enable multi-purpose | | | | }catch (Exception ex) |
| customization of the resulting PDF. Main functions allow | | | | {throw ex; |
| to convert HTML represented as a File, Page from Url | | | | } |
| address, Stream or as a String. | | | | } |
| Developers can easily invoke the converting | | | | } |
| component in their own application or website projects | | | | Adobe's PDF format is one of the most widely |
| on base of ASP.NET. To deploy the PDF Duo .Net | | | | accepted document formats in use today. Most users |
| component you will need only three lines of code. | | | | and clients expect that the software you write will be |
| Installing package is provided with fully featured demos | | | | able to generate and work with PDFs. Unfortunately, |
| written in both C# and Visual Basic. Simple examples | | | | however, Adobe does not offer a free SDK that you |
| with source code help you using the PDF Duo .Net | | | | can download and use; you have to pay to license the |
| component to successfully convert HTML to PDF. | | | | API. |
| I have used PDFDuo-NET.dll (version 2.3) in my project | | | | Statically creating PDF files is quite simple. Applications, |
| which is very useful. First, you need to convert content | | | | such as OpenOffice.org Writer, give the user options |
| of your ASPX to HTML and then converted that | | | | to export a word processor document as a PDF file. |
| HTML content into a PDF file or another way which I | | | | Users can even find utilities that allow them to "print" |
| use is to create a simple HTML string and then | | | | directly to a PDF file. Features like these are |
| convert it. | | | | well-known to end users and are useful for creating a |
| See below C# code:using System;using | | | | PDF based off a document originally created in |
| System.Web;using System.Web.UI;using | | | | another format. |
| System.IO;using DuoDimension;public partial class | | | | But what about dynamic PDF generation? Some |
| _Default : System.Web.UI.Page | | | | programs need to be able to write out PDF files. PDF |
| {protected void Page_Load(object sender, EventArgs | | | | Duo .NET alleviates this problem. It will give you the |
| e) | | | | ability to add PDF functionality to your applications. |
| {string html = "<table width='240'>" + | | | | Using PDF Duo .NET, you can create PDF by |
| "<tr style='background-color:#00AAFF'><td | | | | converting HTML string or file, so you can deliver the |
| width='50%'>Product</td><td | | | | functionality your users expect. |
| width='25%'>Quantity</td><td>Cost< | | | | It is up to you how you generate your HTML from |
| td></tr>" + | | | | your data source and then convert it to PDF or |
| "<tr><td>Product Name 1</td><td>5< | | | | another option is to convert your ASPX to HTML first |
| td><td>$100</td></tr>" + | | | | and then to PDF. This need to be done because PDF |
| "<tr><td>Product Name 2< | | | | Duo .NET component can only works with clear html |
| td><td>15</td><td>$300</td>< | | | | format. It did not support for asp:control and |
| tr>" + | | | | runat=server tag for now. You can apply styleshhet to |
| "<tr><td>Product Name 3< | | | | tables, h1, h2, paragraph, and all others necessary |
| td><td>55</td><td>$500</td>< | | | | stylesheet tag to complete your PDF. |
| tr>" + | | | | PDF Duo .NET is absolutely independent, doesn't |
| "</table>";string pdf = "pdf_file.pdf"; | | | | require any additional components and really |
| DuoDimension.HtmlToPdf conv = new | | | | appropriate for ASP.NET websites. The component is |
| DuoDimension.HtmlToPdf();conv.PageInfo.PageFormat | | | | written entirely in C# for the .NET platform. PDF Duo |
| = ePageFormat.A4;conv.PdfDocumentInfo.Title = | | | | .NET is a library that allows you to generate (convert) |
| "Generate PDF from HTML source";conv.Header = | | | | PDF documents from HTML web page. |