TRY THE BEST
- Convert any url or html file to pdf
- Convert any raw html code to pdf
- No external dependencies
- Powerful Javascript engine
- HTML5/CSS3 support
- Customizable headers and footers
- PDF/A, PDF/X standards support
BEST SAMPLES AND SUPPORT
LIVE DEMO C#
LIVE DEMO VB.NET
ONLINE DOCUMENTATION
The free trial contains ready to use samples, coded in C# and VB.NET for Windows Forms, ASP.NET, ASP.NET MVC with Razor and ASPX engines.
Select.Pdf Library for .NET works on any Windows OS and on Windows Azure.
VERY EASY TO USE
Converting from html to pdf with Select.Pdf is very easy. Take a look at the following code sample:
1 2 3 4 5 6 7 8 9 10 11 |
// instantiate the html to pdf converter HtmlToPdf converter = new HtmlToPdf(); // convert the url to pdf PdfDocument doc = converter.ConvertUrl(url); // save pdf document doc.Save(file); // close pdf document doc.Close(); |
Html to Pdf Converter Most Important Features
- Convert any web page to pdf
- Convert any raw html string to pdf
- Set pdf page settings (page size, page orientation, page margins)
- Resize content during conversion to fit the pdf page
- Set pdf document properties
- Set pdf viewer preferences
- Set pdf security (passwords, permissions)
- Convert multiple web pages into the same pdf document
- Set conversion delay and web page navigation timeout
- Custom headers and footers
- Support for html in headers and footers
- Possibility to have different headers and footers for specific pages
- Automatic and manual page breaks
- Repeat html table headers on each page
- Support for @media types screen and print
- Support for internal and external links
- Generate bookmarks automatically based on html elements
- Support for HTTP headers
- Support for HTTP cookies
- Possibility to manually start the html to pdf conversion from Javascript
- Support for web pages that require authentication
- Support for proxy servers
- Possibility to convert only a section of a web page to pdf
- Possibility to exclude certain html elements from conversion
- Enable/disable javascript
- Modify color space
- Support for PDF/A, PDF/X standards
- Multithreading support
- HTML5/CSS3 support
- Web fonts support
Convert from Html To Pdf in ASP.NET MVC (C# and VB.NET)
It’s very easy to use SelectPdf SDK for .NET in ASP.NET MVC applications. Take a look at the simple code below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
[HttpPost] public ActionResult Convert(FormCollection collection) { // read parameters from the webpage string url = collection["TxtUrl"]; string pdf_page_size = collection["DdlPageSize"]; PdfPageSize pageSize = (PdfPageSize)Enum.Parse(typeof(PdfPageSize), pdf_page_size, true); string pdf_orientation = collection["DdlPageOrientation"]; PdfPageOrientation pdfOrientation = (PdfPageOrientation)Enum.Parse( typeof(PdfPageOrientation), pdf_orientation, true); int webPageWidth = 1024; try { webPageWidth = System.Convert.ToInt32(collection["TxtWidth"]); } catch { } int webPageHeight = 0; try { webPageHeight = System.Convert.ToInt32(collection["TxtHeight"]); } catch { } // instantiate a html to pdf converter object HtmlToPdf converter = new HtmlToPdf(); // set converter options converter.Options.PdfPageSize = pageSize; converter.Options.PdfPageOrientation = pdfOrientation; converter.Options.WebPageWidth = webPageWidth; converter.Options.WebPageHeight = webPageHeight; // create a new pdf document converting an url PdfDocument doc = converter.ConvertUrl(url); // save pdf document byte[] pdf = doc.Save(); // close pdf document doc.Close(); // return resulted pdf document FileResult fileResult = new FileContentResult(pdf, "application/pdf"); fileResult.FileDownloadName = "Document.pdf"; return fileResult; } |
More details and also VB.NET sample code here: http://selectpdf.com/convert-from-html-to-pdf-in-asp-net-mvc-csharp-and-vb-net/.