PHP / COM
Posted: Wed May 15, 2002 8:32 am
Hi everyone, the purpose of my php script is to write some words in a word document and then save & print it.
// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
$word->Visible = 1;
$word->Documents->Add();
$word->Selection->TypeText("Test1");
$word->Selection->TypeParagraph();
$word->Selection->TypeParagraph();
$word->Selection->TypeText("Test2");
$word->Selection->TypeParagraph();
$word->Selection->TypeParagraph();
$word->Selection->TypeText("Test3");
$word->PrintOut();
$word->Documents[1]->SaveAs("c:\\PHP Word Output.doc");
//closing word
$word->Quit();
//free the object from the memory
$word->Release();
$word = null;
Everything is working fine except the $word->PrintOut() function which delivers the following error message:
Warning: Invoke() failed: Exception occured. Source: Microsoft Word Description: Printing is not possible; no printer is installed.
The PHP Server got 3 Printers in its Windows Printer Folder (connected via LAN) so there are printers installed.
Anyone got a clue ?
// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
$word->Visible = 1;
$word->Documents->Add();
$word->Selection->TypeText("Test1");
$word->Selection->TypeParagraph();
$word->Selection->TypeParagraph();
$word->Selection->TypeText("Test2");
$word->Selection->TypeParagraph();
$word->Selection->TypeParagraph();
$word->Selection->TypeText("Test3");
$word->PrintOut();
$word->Documents[1]->SaveAs("c:\\PHP Word Output.doc");
//closing word
$word->Quit();
//free the object from the memory
$word->Release();
$word = null;
Everything is working fine except the $word->PrintOut() function which delivers the following error message:
Warning: Invoke() failed: Exception occured. Source: Microsoft Word Description: Printing is not possible; no printer is installed.
The PHP Server got 3 Printers in its Windows Printer Folder (connected via LAN) so there are printers installed.
Anyone got a clue ?