Implicit Printing
There are certain scenarios when user may request for printing of reports without opening the report when the report content is quite huge on click of button.I was not able to find any OOB business service which prints BIP report on client machine. There is business service for actuate report that does printing task but that can't be used for BIP reports. One of the alternate way to print BIP reports without opening them is to fetch content of report in the code using shell and fire verbex print. Please find below the code snippet to achieve this. This can be used for silent printing for any document.
function WebApplet_PreInvokeMethod (MethodName)
{
if(MethodName == "Printer")
{
var TargetFolder = "D:\Program Files\Siebel8\Files"; //This is the folder name where report document is kept
var oShell = COMCreateObject("Shell.Application"); //Creating Shell
var objFolder = oShell.Namespace(TargetFolder);
var objItem = objFolder.ParseName("AccountListReport.rtf"); //Name of the document to print
objItem.InvokeVerbEx("Print") // Print without opening the document
return(CancelOperation);
}
return (ContinueOperation);
}
The key here is InvokeVerbx method. The Shell object has a method called InvokeVerbEx that allow us perform the tasks that show up when we do right-click a file in Windows Explorer. Following options could be used with this method Open, Print, Edit, Cut, Copy, Delete, etc. The Shell object allows us to perform all those tasks programmatically.
Happy Printing!!
תגובות
הוסף רשומת תגובה