Wednesday, November 1, 2017

Free HTML to PDF library  .NET (c#)


You may find various libraries that convert HTML to pdf. But for me, I find SelectPDF the best. This library can help those developers who want it for free to convert few (not more than 5) pages long.
You can easily convert any webpage to pdf with different page settings parameters and custom pdf page breaks.
SelectPDF provides you a full featured free(community edition) .NET library for HTML to PDF conversion. Its only limitation is that it can generate pdf up to 5 pages. 

With few lines of codes, you can convert your URL or HTML to pdf content.

            // 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();



You can also get the library in visual studio from nuget.

No comments:

Post a Comment