News and events
- Popups with FancyBox Hello... today I'm gonna teach you how to show a popup with FancyBox. FancyBox is a tool to show images, html content and...
- Booking Calendar - Online booking plugin for Wordpress Browsing the web, I found this plugin to make online bookings. It's a plugin that allow us to add a form into our blog to make...
- Export a GridView to Word format with ASP.net Following our series of Export to... this time is the turn of Word format. (.doc). Still being really simple. We put the next...
Contact us
If you have any doubt or suggestion, you may contact us with the next form:
In this example, I'll teach you how to export an URL to a PDF document, using the WinNovative WnvHTMLConvert library.
Sadly this library isn't free, but you can download the DLL wich has only one restriction and that is every time you export, it prints over the PDF a message saying you are using an evaluation version.
The link to download the DLL is the next one: http://www.winnovative-software.com/download.aspx You shoud download the first in the list, HTML to PDF Converter Library v5.1.
Next step, unzip de DLL in the Bin folder of your project.
Well, now we should import the namespace
<%@ Import Namespace="Winnovative.WnvHtmlConvert" %>
And now, the button code. Watch that they are multiple options at the moment of export the PDF. I only put a few, you can watch the remain properties in the examples or in the documentation of the library
// Create the PDF converter.
PdfConverter pdfConverter = new PdfConverter();
// Set the license key. To get te license, you need to register in WinNovative's site
pdfConverter.LicenseKey = "Put your licence key here.";
pdfConverter.ScriptsEnabled = true;
pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.NoCompression;
pdfConverter.PdfDocumentOptions.PdfPageOrientation = PDFPageOrientation.Portrait;
pdfConverter.PdfDocumentOptions.SinglePage = true;
// Set to generate selectable pdf or a pdf with embedded image
pdfConverter.PdfDocumentOptions.GenerateSelectablePdf = true;
// Performs the conversion and get the pdf document bytes that you can further
// save to a file or send as a browser response
byte[] pdfBytes = pdfConverter.GetPdfFromUrlBytes("put here the url you want to export");
// Send the PDF document as a response to the browser
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.Clear();
response.AddHeader("Content-Type", "application/pdf");
response.AddHeader("Content-Lenght", pdfBytes.Length.ToString());
response.BinaryWrite(pdfBytes);
response.Flush();
response.End();

















![Validate my RSS feed [Valid RSS]](/img/valid-rss.png)
