The Free HTML to PDF Converter for .NET from HiQPdf Software is a fast method to easily create richly-formatted PDF documents directly from HTML pages or HTML strings. The majority of the websites are already able to produce reports or to present various results in HTML pages but while the HTML content is simple to generate, edit and display it is not suitable for printing or for transmission by email. The Free HTML to PDF Converter for .NET can accurately convert HTML pages to PDF documents in your ASP.NET websites and .NET desktop applications. Free HTML to PDF Converter Library for .NET is the limited free version of the fully featured HiQPdf HTML to PDF Library for .NET from HiQPdf Software. With Free HTML to PDF Converter Library for .NET you can create maximum 3 PDF pages of high quality content for free. If you want to create larger unlimited PDF documents or you if you need advanced features like live URLs, internal links, outlines, table of contents, headers and footers, PDF forms, edit, merge and split PDF documents, extract text and images from PDF or PDF pages rasterization you can use the full version of the software. Free HTML to PDF Converter for .NET Features
C# Code Sample for ASP.NETThis sample shows how easy you can create the PDF documents from existing HTML pages or HTML strings. The HTML page containing HTML5 code, CSS3, JavaScript or SVG. With just a few lines of code you can get richly formatted PDF document. In this example you can see how to set simple parameters like the PDF page size, orientation and margins, convert the HTML code or URL to PDF and download the resulted PDF in a browser as attachment or inline. // create the HTML to PDF converterHtmlToPdf htmlToPdfConverter = new HtmlToPdf();// set PDF page size and orientationhtmlToPdfConverter.Document.PageSize = GetSelectedPageSize();htmlToPdfConverter.Document.PageOrientation = GetSelectedPageOrientation();// set PDF page marginshtmlToPdfConverter.Document.Margins = new PdfMargins(0);// convert HTML to PDFbyte[] pdfBuffer = null;if (radioButtonConvertUrl.Checked){ // convert URL to a PDF memory buffer string url = textBoxUrl.Text; pdfBuffer = htmlToPdfConverter.ConvertUrlToMemory(url);}else{ // convert HTML code string htmlCode = textBoxHtmlCode.Text; string baseUrl = textBoxBaseUrl.Text; // convert HTML code to a PDF memory buffer pdfBuffer = htmlToPdfConverter.ConvertHtmlToMemory(htmlCode, baseUrl);}// inform the browser about the binary data formatHttpContext.Current.Response.AddHeader("Content-Type", "application/pdf");// set how to open the PDF document, attachment or inline, and the file nameHttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("{0}; filename=HtmlToPdf.pdf; size={1}", checkBoxOpenInline.Checked ? "inline" : "attachment", pdfBuffer.Length.ToString()));// write the PDF buffer to HTTP responseHttpContext.Current.Response.BinaryWrite(pdfBuffer);// call End() method of HTTP response to stop ASP.NET page processingHttpContext.Current.Response.End(); More InformationFor more HTML to PDF Conversion features see the Full Version of HiQPdf HTML to PDF Converter for .NET and the Online HTML to PDF Converter Documentation |