Meridian 2010

UniqueInputPrefix

# Copyright (c) 2019 ActivePDF, Inc.
# ActivePDF Meridian 2010
# Example generated 03/22/19 

require 'win32ole'

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

# Instantiate Object
oMER = WIN32OLE.new("APMeridian.Object")

# Specify the IP address and Port to use to reach the Meridian Server
oMER.StartRemoteClient('192.168.1.100', 58585)

# Must use either SetUniuqeInput or SetProcessAndThread
# Call SetUniqueInput with the full path to the input
# it is best to use a unique filename to avoid potential
# name collisions, if the filename is unique set the second
# parameter to true
oMER.SetUniqueInput(strPath + 'Word.doc', true)

# Here we are using SetUniqueInput, as the print job is
# from Microsoft Word, Word will add 'Microsoft Word - '
# to the print job so we need to let meridian know using
# UniqueInputPrefix
oMER.UniqueInputPrefix = 'Microsoft Word - '

# Path and filename of the created PDF
oMER.OutputDirectory = strPath
oMER.NewDocumentName = 'Word.pdf'

# Set the ModelPrinter to the remote Meridian printer
# This printer must be added locally to the remote system
oMER.ModelPrinter = '\\192.168.1.100\Meridian'

# Prepare to start the printing process
intStartPrinting = oMER.StartPrinting()
if intStartPrinting != 0
  puts "Error in StartPrinting: #{intStartPrinting}"
end

# Automate Word to print a document to Meridian


# End the printing process
oMER.StopPrinting()

# Wait(seconds) for job to complete
intWait = oMER.Wait(30)
if intWait != 0
  puts "Error in Wait: #{intWait}"
end

# Release Object
oMER = ''

# Process Complete
puts "Done!"

Copyright © 2019 ActivePDF, Inc