Make PDF from HTML with C# in ASP.Web

PDF Duo .Web is a changing element for use in ASP.Web (VB, C# etc.) and allows to convert HTML to PDF. The primary class HtmlToPdf gives many methods and properties to allow multi-reason customization of the ensuing PDF. Major functions enable to convert HTML represented as a File, Web page from Url tackle, Stream or as a String.

Builders can very easily invoke the changing element in their individual application or website tasks on foundation of ASP.Web. To deploy the PDF Duo .Web element you will require only three strains of code. Putting in package is supplied with fully featured demos published in the two C# and Visual Standard. Very simple examples with supply code assist you making use of the PDF Duo .Web element to correctly convert HTML to PDF.

I have applied PDFDuo-Web.dll (variation two.three) in my job which is pretty helpful. 1st, you require to convert content material of your ASPX to HTML and then converted that HTML content material into a PDF file or an additional way which I use is to generate a easy HTML string and then convert it.

See below C# code:
making use of Program
making use of Program.Internet
making use of Program.Internet.UI
making use of Program.IO
making use of DuoDimension

community partial class _Default : Program.Internet.UI.Web page

guarded void Web page_Load(object sender, EventArgs e)

string html = “

” +

” +

” +

” +

” +

Product Quantity Value
Product Title one 5 $a hundred
Product Title two 15 $three hundred
Product Title three fifty five $five hundred


string pdf = “pdf_file.pdf”
DuoDimension.HtmlToPdf conv = new DuoDimension.HtmlToPdf()
conv.PageInfo.PageFormat = ePageFormat.A4
conv.PdfDocumentInfo.Title = “Make PDF from HTML supply”
conv.Header = “
HTML table Instance
attempt

conv.OpenHTML(html)
conv.SavePDF(MapPath(“~/Experiences/”) + pdf)

capture (Exception ex)

throw ex

Adobe’s PDF structure is a person of the most widely approved document formats in use these days. Most customers and shoppers be expecting that the program you publish will be in a position to crank out and function with PDFs. However, having said that, Adobe does not present a no cost SDK that you can obtain and use you have to pay to license the API.

Statically creating PDF documents is pretty easy. Applications, such as OpenOffice.org Author, give the consumer selections to export a word processor document as a PDF file. Buyers can even obtain utilities that enable them to “print” instantly to a PDF file. Functions like these are nicely-acknowledged to finish customers and are helpful for creating a PDF dependent off a document initially established in an additional structure.

But what about dynamic PDF era? Some courses require to be in a position to publish out PDF documents. PDF Duo .Web alleviates this difficulty. It will give you the capacity to insert PDF performance to your apps. Employing PDF Duo .Web, you can generate PDF by changing HTML string or file, so you can deliver the performance your customers be expecting.

It is up to you how you crank out your HTML from your information supply and then convert it to PDF or an additional solution is to convert your ASPX to HTML 1st and then to PDF. This require to be performed simply because PDF Duo .Web element can only will work with distinct html structure. It did not assist for asp:control and runat=server tag for now. You can apply styleshhet to tables, h1, h2, paragraph, and all other individuals vital stylesheet tag to entire your PDF.

PDF Duo .Web is absolutely impartial, won’t have to have any supplemental elements and definitely acceptable for ASP.Web sites. The element is published fully in C# for the .Web system. PDF Duo .Web is a library that lets you to crank out (convert) PDF paperwork from HTML web web page.

For much more details about the element remember to pay a visit to the item web page:
http://www.duodimension.com/html_pdf_asp.web/element_html_pdf.aspx

If you have any inquiries or issues about element, permit us know:
assist@duodimension.com