Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Html to PDF
Message
From
05/03/2014 19:55:25
 
 
To
05/03/2014 01:06:18
General information
Forum:
ASP.NET
Category:
Other
Title:
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01595796
Message ID:
01595852
Views:
33
http://www.html-to-pdf.net/?gclid=CNO6rYfY-rwCFSISMwodQHUAlg is the one we have adopted.

It is very easy to use and converts exactly what it should. It also supports .NET directly and only two DLLs are needed to reference in your project.

This is an example of the code:
        Dim lcFile As String = ""
        Dim lcSerialNumber As String = ""
        Dim lcUrl As String = ""
        Dim lnLocation As Integer = 0
        Dim loByte() As Byte = Nothing
        Dim loPdfConverter As ExpertPdf.HtmlToPdf.PdfConverter = New ExpertPdf.HtmlToPdf.PdfConverter

        ' If we do not have a Url
        If PDFUrl.Text.Length = 0 Then
            MessageBox.Show("You need to enter a Url.", oApp.cTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop)
            Exit Sub
        End If

        ' If we do not have a destination file
        If PDFDestinationFile.Text.Length = 0 Then
            MessageBox.Show("You need to select a destination file.", oApp.cTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop)
            Exit Sub
        End If

        ' Initialization
        lcSerialNumber = ""
        lcUrl = PDFUrl.Text
        lnLocation = oApp.RAt("\", lcUrl)
        lcFile = Mid(lcUrl, lnLocation + 1)

        Try
            loPdfConverter.PdfDocumentOptions.PdfPageSize = ExpertPdf.HtmlToPdf.PdfPageSize.A4
            loPdfConverter.PdfDocumentOptions.PdfCompressionLevel = ExpertPdf.HtmlToPdf.PdfCompressionLevel.Normal
            loPdfConverter.PdfDocumentOptions.LeftMargin = 5
            loPdfConverter.PdfDocumentOptions.RightMargin = 5
            loPdfConverter.PdfDocumentOptions.TopMargin = 5
            loPdfConverter.PdfDocumentOptions.BottomMargin = 5
            loPdfConverter.PdfDocumentOptions.InternalLinksEnabled = True
            loPdfConverter.PdfFooterOptions.ShowPageNumber = False

            ' If we have a license number
            If lcSerialNumber.Length > 0 Then
                loPdfConverter.LicenseKey = lcSerialNumber
            End If

            loByte = loPdfConverter.GetPdfFromUrlBytes(lcUrl)
            File.WriteAllBytes(PDFDestinationFile.Text, loByte)
        Catch loError As Exception
            MessageBox.Show(loError.Message, oApp.cTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop)
            Exit Sub
        End Try
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform