Tutorial: how to create PDF format document in Visual Basic using PDFDoc Scout library

Quick Start Guide: 
How to create PDF document from Visual Basic: "Hello, World!" PDF document
 

You can download the source code of this example here: pdfdocscout_vb.zip

 

This guide will teach you how to create simple PDF document using PDFDoc Scout library and Visual Basic

 
1) Install PDF Scout library on your computer and run Visual Basic. Go to File and click New
 
Visual Basic file menu new command
 
The Project Wizard will appear:
New Visual Basic project wizard
2) Select Standard EXE project type and click Open to create a new project.
Visual Basic will generate new project called Project1 and will automatically open the main form of the generated project:

New project generated by Visual Basic
 
3) Click on Form1 surface and Visual Basic will show the code window for Form_Load event:
Visual Basic form load event code handler auto generated
 
4) Now you have to add the code that will create PDF document using PDF Scout library. 
 
Here is the source code that you can simply copy and paste into Visual Basic:
 

Set PDFDoc = CreateObject("PDFDocScout.PDFDocument")
PDFDoc.InitLibrary "demo", "demo"

PDFDoc.OutputFileName = "HelloWorld.pdf"
PDFDoc.AutoOpenGeneratedPDF = true ' automatically open generated PDF document in default PDF viewer application

PDFDoc.BeginDocument

' add text to current page
PDFDoc.Page.AddText "Hello, World!", 100, 100, 15

PDFDoc.EndDocument ' close document

 
This function will create PDF file "HelloWorld.PDF" pdf document on drive C:\
 
Hint:
You can simply copy the source code from the snippet above and then paste it in the Visual Basic code editor as it's shown on the screenshot below:
 
5) Press F5 to run the application (you can also use "Run" | "Start" menu command). 
 
Run project button on toolbar
 
6) Visual Basic will run the application and application will generate PDF file "c:\HelloWorld.PDF".
 
You can view generated pdf document file (.PDF) using Adobe Reader or another application that is capable of viewing   pdf documents.
 
Generated pdf document in Adobe Reader
 
 
You can download the source code of this example here: pdfdocscout_vb.zip
Filed in: PDFDoc Scout SDK

Tutorials: