You can try using the printer extension in PHP to send the PDF Output Document directly to a printer. See:
https://stackoverflow.com/questions/233 ... to-printer
http://windows.php.net/downloads/pecl/s ... 0.1.0-dev/
If you have Acrobat Reader installed on your PM Server, you can also send a system command in a trigger to print:
exec("AcroRd32.exe /t <filename.pdf> <printername> <drivername> <portname>");
on a Linux server with CUPS, you can use:
exec("lp -d <printer-name> <filename.pdf>");
To see the list of printer names, use the command
lpstat -a or use this address in a web browser:
http://<ip-or-domain>:631/printers
If you want to copy an Output Document file to a specified directory, you can use this trigger code:
Code: Select all//set to the Unique ID of the Output Document:
$outDocId = '233815488585c62af61e2a6077136729';
//if needing to generate the output document file, because no Output Document step in task:
PMFGenerateOutputDocument($outDocId);
//retrieve info from the database about the generated output document file
$caseId = @@APPLICATION;
$query = "SELECT APP_DOC_UID, DOC_VERSION FROM APP_DOCUMENT
WHERE APP_UID='$caseId' AND DOC_UID='$outDocId' AND
APP_DOC_STATUS='ACTIVE' ORDER BY APP_DOC_CREATE_DATE DESC";
$result = executeQuery($query);
if (!is_array($result) or count($result) == 0) {
throw new Exception("Unable to find generated Output Document in database.");
}
//get the filename of the uploaded document:
$d = new AppDocument();
$aFile = $d->Load($result[1]['APP_DOC_UID'], $result[1]['DOC_VERSION']);
$originalFilename = $aFile['APP_DOC_FILENAME'].'_'.$aFile['DOC_VERSION'];
$filename = $result[1]['APP_DOC_UID'].'_'.$result[1]['DOC_VERSION'];
$g = new G();
$path = PATH_DOCUMENT. $g->getPathFromUID($caseId) .PATH_SEP. "outdocs" .PATH_SEP. $filename .'.pdf';
//change "/my/path/" for your server:
$newPath = '/my/path/' . $originalFilename . '.pdf';
copy($path, $newPath);
This code will automatically generate the output document file or you can remove the PMFGenerateOutputDocument() function call and set this trigger to fire after an Output Document step.