Home Navigation menu
Products Download Order Support Contact us For Publishers OEM
Step by Step:How to create PDF from HTML using HTML2PDF Add-on for Pdf Creator Pilot library:"Hello, HTML2PDF!" example
HTML2PDF Add-on for PDF Creator Pilot can be used in Visual Basic, Visual Basic.NET, ASP, ASP.NET, VBScript (Visual Basicscripted language) as well as in Visual C, Visual C# and Delphi.This page contains step by step tutorial that will teach you how to convert HTML document intoPDFfile from VBScript using
PDFCreator Pilot
library and
HTML2PDF add-on
.Windows 98/2000/ME/XP has a built-in VBScript interpreter so all you have to do is to create a text file which contains script andsave it using
.vbs
extension.
1)
Install
PDF Creator Pilot
library and
HTML2PDF add-on
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:1. create and initialize PDF Creator Pilot object2. set filename for the PDF file3. initialize HTML2PDF add-on and connect to PDF Creator Pilot instance4. load HTML document into HTM2PDF add-on5. convert HTML document into PDF6. disconnect HTML2PDF add-on from PDF Creator Pilot instance
Content of "HelloHTML2PDF.vbs" file:
' create pdf library object SetPDF = CreateObject("PDFCreatorPilot2.piPDFDocument")' initialize PDF Engine PDF.StartEngine "demo@demo", "demo"' set AutoLaunch flag to TRUE to automatically open the generated pdf generation PDF.AutoLaunch = TRUEPDF.FileName = "HelloHTML2PDF_VBS.pdf"' start document generation PDF.BeginDocSetHTML = CreateObject("HTML2PDFAddon.HTML2PDF")' initialize HTML engine HTML.StartHTMLEngine "",""' connect to PDF Creator Pilot instance HTML.ConnectToPDFLibrary PDF' load HTML file into HTML renderer HTML.LoadFromString "<HTML><BODY><H1>Hello,PDF2HTML!</H1></BODY></HTML>", ""' convert whole HTML document into PDF HTML.ConvertAll' disconnect from PDF Creator Pilot instance HTML.DisconnectFromPDFLibrarySetHTML = nothing' finalize PDF generation PDF.EndDoc