Meridian 2010

UniqueInputPrefix

<!-- Copyright (c) 2019 ActivePDF, Inc. -->
<!-- ActivePDF Meridian 2010 -->
<!-- Example generated 08/21/19  -->

<%
Dim strPath, intStartPrinting, intWait

strPath = Server.MapPath(".") & "\"

' Instantiate Object
Set oMER = Server.CreateObject("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 Then
  ErrorHandler "StartPrinting", intStartPrinting
End If

' Automate Word to print a document to Meridian
Set objWord = Server.CreateObject("Word.Application")
objWord.DisplayAlerts = False
Set objDoc = objWord.Documents.Open((strPath & "Word.doc"), False, True)
Set objWordDialog = objWord.Dialogs(97)
objWordDialog.Printer = oMER.ModelPrinter
objWordDialog.DoNotSetAsSysDefault = 1
objWordDialog.Execute
objDoc.PrintOut False
objDoc.Close False
objWord.Quit False
Set objWordDialog = Nothing
Set objDoc = Nothing
Set objWord = Nothing

' End the printing process
oMER.StopPrinting 

' Wait(seconds) for job to complete
intWait = oMER.Wait(30)
If intWait <> 0 Then
  ErrorHandler "Wait", intWait
End If

' Release Object
Set oMER = Nothing

' Process Complete
Response.Write "Done!"

' Error Handling
Sub ErrorHandler(method, outputCode)
  Response.Write("Error in " & method & ": " & outputCode)
End Sub
%>

Copyright © 2019 ActivePDF, Inc