secret
anonymous / Convert2PDF.vbs
Created

  • Download Gist
Convert2PDF.vbs
Visual Basic
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Set fso = CreateObject("Scripting.FileSystemObject")
Set PDFCreator = Wscript.CreateObject("PDFCreator.clsPDFCreator", "PDFCreator_")
 
With PDFCreator
ReadyState = 0
.cStart "/NoProcessingAtStartup"
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveFormat") = 0
.cOption("AutosaveStartStandardProgram") = 0
DefaultPrinter = .cDefaultprinter
.cDefaultprinter = "PDFCreator"
.cClearcache
.cPrinterStop = false
.cOption("AutosaveDirectory") = fso.GetParentFolderName(WScript.Arguments(0))
.cOption("AutosaveFilename") = fso.GetBaseName(WScript.Arguments(0))
.cPrintfile cStr(WScript.Arguments(0))
c = 0
Do While (ReadyState = 0) and (c < 120)
c = c + 1
Wscript.Sleep 250
Loop
.cDefaultprinter = DefaultPrinter
.cClearcache
WScript.Sleep 200
.cClose
End With
 
Public Sub PDFCreator_eReady()
ReadyState = 1
End Sub

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.