Spooler 2017

FormName

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

require 'win32ole'

# Get current path
strPath = File.expand_path(File.dirname(__FILE__)) + "\\"

# Instantiate Object
oSP = WIN32OLE.new("APSpooler.Object")

# Use the PrintJobProfile object to set specific printer settings
# for the print job if the default options are not what is needed.
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
results = oSP.PrintFileCustom(oPJP, strPath + '5pageLI.pdf', '')
if results.Status != 0
  puts "Error with PrintFileCustom:"
  puts "#{results.Status}"
  puts results.Details
  exit 1
end

# Release Object
oPJP = ''

# Release Object
oSP = ''

# Process Complete
puts "Done!"

Copyright © 2018 ActivePDF, Inc