Convert from HTML to PDF in CSharp VB and ASP.NET with a Free 3rd Party Library

Converting from html to pdf is not an easy task. There are some tools that can do that, but most of them cost thousands of dollars. SelectPdf offers a Community Edition (FREE) of the powerful Html To Pdf Converter for .NET that can be found in the full featured pdf library.

 
 
 
 
 
3.6 Star
(59)
52,877 times
Add to favorites
5/10/2019
E-mail Twitter del.icio.us Digg Facebook

Solution explorer

C#
VB.NET
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports ColorCode

Namespace SelectPdf.Samples
	Public Partial Class Samples
		Inherits System.Web.UI.MasterPage

        Protected Sub Page_Load(sender As Object, e As EventArgs)
            If Request.Url.AbsolutePath.ToLower().Contains("default.aspx") Then
                LitCode.Visible = False
            Else
                Try
                    LitCode.Text = "<h1>Sample Code Vb.Net</h1><br/><br/>"
                    Dim code As String = System.IO.File.ReadAllText(Server.MapPath(Request.Url.AbsolutePath) + ".vb")
                    LitCode.Text = LitCode.Text & "<div style='width=90%; overflow: auto; border: 1px solid #DDDDDD; padding: 10px;'>" & New CodeColorizer().Colorize(code, Languages.VbDotNet) & "</div>"
                Catch
                    LitCode.Visible = False
                End Try
            End If
        End Sub
	End Class
End Namespace