Sample source code below will show you how to cope with a difficult task like create new PDF document in VB.NET. ByteScout PDF SDK is the SDK for pdf documents generation, modification and updates. Can also generate and fill PDF forms. Provides support for text (fonts, style, size, font family), layers, pdf form fields, vector and raster drawings. It can be used to create new PDF document using VB.NET.
You will save a lot of time on writing and testing code as you may just take the VB.NET code from ByteScout PDF SDK for create new PDF document below and use it in your application. This VB.NET sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Code testing will allow the function to be tested and work properly with your data.
ByteScout free trial version is available for download from our website. It includes all these programming tutorials along with source code samples.
Imports Bytescout.PDF ''' <summary> ''' This example demonstrates how to create a document and save it to file. ''' </summary> Class Program Shared Sub Main() ' Create new document Dim pdfDocument = New Document() pdfDocument.RegistrationName = "demo" pdfDocument.RegistrationKey = "demo" ' Add page Dim page = New Page(PaperFormat.A4) pdfDocument.Pages.Add(page) ' Add sample content Dim font = New Font(StandardFonts.Times, 24) Dim brush = New SolidBrush() page.Canvas.DrawString("Hello world!", font, brush, 20, 20) ' Save document to file pdfDocument.Save("result.pdf") ' Cleanup pdfDocument.Dispose() ' Open document in default PDF viewer app Process.Start("result.pdf") End Sub End Class