I have been experimenting with an automated print process using com. The code below basically works but it seems that the
$word->ActiveDocument->PrintOut(); line is not being completed before the $word->Quit(); line causing a dialog box asking if i want to abort the printing of the current document.This is all very strange......The function print_pdf below this is working very well and may be of help to anyone trying to do the same thing!
Many thanks in advance!
function print_word($filepath)
{
$word = new COM("word.application") or die("Unable to
instanciate Word");
$word->Visible = 0;
$word->application->DisplayAlerts = 0;
$word->Documents->Open($filepath);
$word->ActiveDocument->PrintOut();
$word->documents->close;
$word->release();
$word = null;
}
function print_pdf($filepath)
{
$pdf1 =new com("AcroExch.App") or die("Can't open acrobat");
$doc=$pdf1->GetActiveDoc();
$doc->Open($filepath,"");
$pddoc=$doc->GetPDDoc();
$numpages=$pddoc->GetNumPages -1;
$printRes=$doc->PrintPagesSilent(0,$numpages,0,1,1);
$pdf1=null;
}