PDF version of this article is available.
Click here to download.
How to create PDF file in VBScript: "Hello, PDF!" example
Step by Step
PDF Creator Pilot can be used in VBScript (Visual Basic scripted language). This page contains a step-by-step tutorial that will teach you how to create PDF files from VBScript using PDF Creator Pilot library.
Windows 98/2000/ME/XP has a built-in VBScript interpreter so all you have to do is to create text file which contains script and save it using ".vbs" extension.
1) Install PDF Creator Pilot library on your computer
2) Run Notepad and create a new text file.
3) To create a PDF file from VBScript, you have to write a very simple script that will do the following steps:
- create and initialize PDF Creator Pilot object;
- set the file name for your PDF file;
- draw "Hello, PDF!" message on the PDF document;
- disconnect from the library.
Content of "HelloPDF.vbs" file:
' create pdf library object
Set PDF = CreateObject("PDFCreatorPilot3.PDFDocument3")
' initialize PDF Engine
PDF.StartEngine "demo@demo", "demo"
' set AutoLaunch flag to TRUE to open document automatically
PDF.AutoLaunch = true
PDF.FileName = "HelloPDF_VBS.pdf"
' start document generation
PDF.BeginDoc
' draw "HELLO, PDF" message on the current PDF page
PDF.PDFPAGE_SetActiveFont "Verdana", True, False, False, False, 14, 0
PDF.PDFPAGE_TextOut 10, 20, 0, "HELLO, PDF!"
' finalize document generation
PDF.EndDoc
' disconnect from library
Set PDF = Nothing
|
Feel free to copy this code to Notepad and save it as "HelloPDF.VBS":
4) Double-click "HelloPDF.VBS" file from Explorer or from another file manager and it will run the script.
If you have PDF viewer installed (for example, Adobe Reader), then the script will open HelloPDF_VBS.PDF file as shown on the screenshot below:

You can download the script code for the described example here (23 KB)
PDF Creator Pilot can be used with different languages to generate PDF files. See "Hello, PDF" example for:
- Visual Basic Script (VBScript)
- Visual Basic (VB)
- Visual Basic.NET (VB.NET)
- C Sharp (C#)
- Active Server Pages (ASP)
- Active Server Pages for .NET (ASP.NET)
- Delphi
- Visual C++
See also:
- PDF documents and PDF files. Introduction and short description
- PDF Creator Pilot technology
- PDF Creator Pilot FAQ
If you have questions related to PDF Creator Pilot, contact us via our online support form.