Spooler 2017

Alphabetical List
Basic Print
Basic Concepts
Basic Print
Alphabetical List

Basic Print

' Copyright (c) 2017 ActivePDF, Inc.
' ActivePDF Spooler 2017
' Example generated 10/23/17 

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")

' 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.PrintFile("Microsoft Print to PDF", strPath & "5pageLI.pdf", "")
If results.Status <> 0 Then
  ErrorHandler "PrintFile", results, results.Status
End If

' 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 © 2017 ActivePDF, Inc