Spooler 2017

FormName

' Copyright (c) 2018 ActivePDF, Inc.
' ActivePDF Spooler 2017
' Example generated 09/22/18 

Dim FSO, strPath, results

' Get current path
Set FSO = CreateObject("Scripting.FileSystemObject")
strPath = FSO.GetFile(Wscript.ScriptFullName).ParentFolder & "\"
Set FSO = Nothing

' Instantiate Object
Set oSP = CreateObject("APSpooler.Object")

' Use the PrintJobProfile object to set specific printer settings
' for the print job if the default options are not what is needed.
Set oPJP = oSP.PrintJobProfile("SettingsOne")

oPJP.BinSource = 15
oPJP.Collate = false
oPJP.ColorMode = 2
oPJP.DPI = 300
oPJP.Duplex = 1
oPJP.FormName = "SampleForm"
oPJP.Nup = 0
oPJP.Orientation = 1
oPJP.PaperSize = 1
oPJP.PrinterName = "Microsoft Print to PDF"
oPJP.PrintOddEvenAll = 3
oPJP.ProfileName = "SettingsOne"
oPJP.Scaling = 1
oPJP.CustomScaling = 95.0
oPJP.TrueTypeOption = 3

' File specific settings
oSP.Copies = 1
oSP.PageRange = "1-2,4"
oSP.PrintAnnotations = true

' Print directly to a printer. Leave first parameter blank for default printer
Set results = oSP.PrintFileCustom(oPJP, strPath & "5pageLI.pdf", "")
If results.Status <> 0 Then
  ErrorHandler "PrintFileCustom", results, results.Status
End If

' Release Object
Set oPJP = Nothing

' Release Object
Set oSP = Nothing

' Process Complete
Wscript.Echo("Done!")

' Error Handling
Sub ErrorHandler(method, oResult, errorStatus)
  Wscript.Echo("Error with " & method & ": " & vbcrlf _
    & errorStatus & vbcrlf _
    & oResult.details)
  Wscript.Quit 1
End Sub

Copyright © 2018 ActivePDF, Inc