Imports ExpertPdf.HtmlToPdf Imports System.IO Namespace Framework Public Class PDF Public cFile As String = "" Public cMessage As String = "" Public cURL As String = "" Public oApp As Framework.App = Nothing Private oProcess As Framework.LXProcess = Nothing ' This is when we access the class in a desktop mode Sub New(ByVal toApplication As Framework.App) oApp = toApplication End Sub ' This is when we access the class in a Web or Web Service mode Public Sub New(ByVal toProcess As Framework.LXProcess) oProcess = toProcess oApp = oProcess.oApp End Sub ' Generate the PDF file Public Function GeneratePDF() As Boolean Dim llSuccess As Boolean = False Dim loDownloadBytes() As Byte = Nothing Dim loFileStream As FileStream = Nothing Dim loPDFConverter As PdfConverter = New PdfConverter ' Reset the values cMessage = "" Try loPDFConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4 loPDFConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal loPDFConverter.PdfDocumentOptions.ShowHeader = False loPDFConverter.PdfDocumentOptions.ShowFooter = False loPDFConverter.PdfDocumentOptions.LeftMargin = 5 loPDFConverter.PdfDocumentOptions.RightMargin = 5 loPDFConverter.PdfDocumentOptions.TopMargin = 5 loPDFConverter.PdfDocumentOptions.BottomMargin = 5 loPDFConverter.PdfDocumentOptions.GenerateSelectablePdf = True loPDFConverter.PdfDocumentOptions.ShowHeader = False loPDFConverter.PdfHeaderOptions.HeaderText = "" loPDFConverter.PdfHeaderOptions.HeaderTextColor = Drawing.Color.Blue loPDFConverter.PdfHeaderOptions.DrawHeaderLine = False loPDFConverter.PdfFooterOptions.FooterText = "" loPDFConverter.PdfFooterOptions.FooterTextColor = Drawing.Color.Blue loPDFConverter.PdfFooterOptions.DrawFooterLine = False loPDFConverter.PdfFooterOptions.PageNumberText = "Page" loPDFConverter.PdfFooterOptions.ShowPageNumber = True 'loPDFConverter.LicenseKey = "put your serial number here" loDownloadBytes = loPDFConverter.GetPdfFromUrlBytes(cURL) ' Create a file and write the byte data to a file. loFileStream = New System.IO.FileStream(cFile, System.IO.FileMode.Create) loFileStream.Write(loDownloadBytes, 0, loDownloadBytes.Length) loFileStream.Close() llSuccess = True Catch loError As Exception cMessage = loError.Message End Try Return llSuccess End Function End Class End NamespaceAnd, then, you can call it like this:
Dim loPDF As Framework.Framework.PDF = New Framework.Framework.PDF(oApp) loPDF.cURL = "http://www.levelextreme.com" loPDF.cFile = "d:\Test.pdf" If Not loPDF.GeneratePDF() Then MessageBox.Show(loPDF.cMessage) Exit Sub End IfThe tool seems to generate the PDF as is. I have not taken the time to analyze all the details, but the HTML in the browser seems to be what is generated as a PDF.