|
'Obtain local file path for later use
arrayScr = Split (WScript.ScriptFullName, "\", -1, 1)
For i = 0 to UBound(arrayScr) - 1
strPath = strPath & arrayScr(i) & "\"
Next
'File settings on file to create and file to convert
strPathToFiles = strPath
strFileToCreate = strPathToFiles & "W-Test.pdf"
strFileToConvert = strPathToFiles & "word.doc"
'Instantiate the PrimoPDF Object
Set APPrimo = CreateObject("PrimoAPI.Object")
APPrimo.UserString = "TG0Axxxxxxxxxx"
APPrimo.LicenseKey = "752xxxxxxxxxxxx119510012413123xxxxxxxxxx"
'Set the output location and name of the PDF to be created
APPrimo.OutputFile = strFileToCreate
'**PDF Quality Settings
'DPI resolution of created PDF
APPrimo.Resolution = 300
APPrimo.DebugLogging = TRUE
APPrimo.CreatePrinter
'The code will also check and notify when the PDF file is created 'All below code 'is provided "AS IS" and is not supported by activePDF
'Word Automation was tested with Microsoft Word 2003
'**Automate Word to print to the PrimoPDF Printer
Set WordObject = CreateObject("Word.Application")
WordObject.DisplayAlerts = False
Set NewDoc = WordObject.Documents.Open (strFileToConvert, False, True)
Set WordDialog = WordObject.Dialogs(97)
'After setting up PrimoAPI above, all we need to do is specify it as the printer 'from
the application which is creating the PDF
WordDialog.Printer = "PrimoAPI"
WordDialog.DoNotSetAsSysDefault = 1
WordDialog.Execute
NewDoc.PrintOut False
NewDoc.Close False
WordObject.Quit False
Set WordObject = Nothing
Set FSO = Nothing
Set APPrimo = Nothing
|