Question

We have an Oracle BPM 10g activity that:

  1. Reads a form-fill protected Word document template.
  2. Merges data into the fields.
  3. Saves the merged/filled copy to the filesystem.
  4. Prints the document to a selected, pre-defined printer, OR to the default printer.

All of this works fine when printing to a "real" printer. However, there is now a need to output the Word document to TIFF. Attempting to use "Microsoft Document Image Writer" as one of the printer selections does not work as expected. Normally, when printing to the Microsoft Document Image Writer from Word (or any other application) directly, you're prompted for a location to save the resultant file. This prompting does not occur when attempting to print from this particular activity in BPM 10g.

Ideally, we actually would like to bypass the dialog and output the TIFF directly to the filesystem. However, I have not found a way to control this programmatically. That is, being able to specify the destination filename in code. Right now, I'm just trying to get output to the Microsoft Document Image Writer at all, to make sure it works.

So, the bottom line question(s) is/are:

  • Can this be done? I.e., printing to Microsoft Document Image Writer
  • If yes, can the file location dialog be suppressed?
  • How?
Was it helpful?

Solution 2

Thank you, domke consulting.

After more searching, I found this forum post on MSDN.

Adding these registry entries to suppress the dialog box and suppress post-generation output seemed to do the trick:

In HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\MODI\MDI Writer

  • PrivateFlags = 17 (Decimal)
  • OpenInMODI = 0 (Decimal)

For our purposes, this seems to work fine if we call the printOut() method with the following relevant arguments (other arguments omitted here for brevity):

document.printOut(outputFileName : "C:\\temp\\fileName.tif", printToFile : true);

OTHER TIPS

You said nothing about the way you're automating Word. In Word VBA, you may use this sample to print out the active document immediately without showing the print dialog:

Public Sub PrintToXPS()
'Presume that Microsoft XPS Document Writer was already
'set up as ActivePrinter   
Dim strFilePath As String    
strFilePath = "C:\temp\helloworld.xps"    
ActiveDocument.PrintOut Background:=False, outputfilename:=strFilePath
End Sub

There's no need to use the print dialog instead. However, if you want to operate through the dialog object, that can be done in Word using a variable of type Word.Dialog and providing the necessary parameters, e.g.

   Dim dlgFilePrint As Word.Dialog
Set dlgFilePrint = Application.Dialogs(wdDialogFilePrint)
dlgFilePrint.Update
dlgFilePrint.PrToFileName = strFilePath
dlgFilePrint.printtofile = True
'add other parameters as needed ...
'lock up parameter names in  Word VBA Online Help using "WdWordDialog-Enumeration"
'as key word
dlgFilePrint.Execute

What I did here with the XPS printer, you may of course do also with any other printer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top