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