Two Pilots™    Home  |  Navigation  |  Site Map  |  Products  |  Download  |  Prices  |  For Partners  |  Support


All forums · Statistics · Search ·

Two Pilots forum / For software developers / Request demo code for convert multiple html files
Author Message
Anonymous
# Posted: 4 Jan 2010 02:08


Need help for demo code regarding convert multiple html files in one folder into one pdf.

max.f
# Posted: 4 Jan 2010 07:41


Well, I guess something like this will do it. Save this text in a new text file and rename it to "htmls2pdf.vbs". Double click the file to run it.

'========Visual Basic Script code ===========
Set PDF = CreateObject("PDFCreatorPilot.PDFDocument3")
Set HTML = CreateObject("HTML2PDFAddon.HTML2PDF2")
HTML.SetLogFile "q.log"

PDF.StartEngine "demo@demo", "demo"
PDF.AutoLaunch = False
PDF.FileName = "out.pdf"
PDF.Resolution = 96
PDF.BeginDoc

HTML.StartHTMLEngine "demo@demo", "demo"
HTML.ConnectToPDFLibrary PDF

Set Fso = CreateObject("Scripting.FileSystemObject")
Set FilesList = Fso.GetFolder("C:Folderwithhtmlfiles").Files

If FilesList.Count > 0 Then
For Each File in FilesList
If Right(File.Name, 5)=".html" Or Right(File.Name, 4)=".htm" Then
HTML.LoadHTMLFile File.Path
End If
Next
End If

HTML.ConvertAll
HTML.DisconnectFromPDFLibrary
PDF.EndDoc

Set HTML = nothing
Set PDF = nothing
'========Visual Basic Script code ===========

--
Max Filimonov,
max.f@colorpilot.org

 

 

Powered by miniBB 2.0 RC7 © 2001-2004 Page creation time (sec.): 0.013

 

Page top