note 49953 deleted from ref.com by cmb
| From: | cmb@php.net | Date: | Sun, 30 Jun 2019 07:52:27 +0000 |
| Subject: | note 49953 deleted from ref.com by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211422@lists.php.net to get a copy of this message | ||
Note Submitter: pelegk2 at walla DOT co DOT il
----
Printing to a network printer :
read this note for :
NOTE: Using COM with windows NT/2000/XP with apache as a service
- Run dcomcnfg.exe
- Find word application and click properties
- Click the Security tab
- Use Custom Access Permissions
- Add the user who runs the web server service
- Use Custom Launch permissions
- Add the user who runs the web server service
THEN
<?php
// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word->Version}\n";
// bring it to front
$word->Visible = 1;
//this is for example a printer on my network
$word->ActivePrinter = "\\\\192.168.4.201\\printer1";
// Open a word document, or anything else that word
// can read
$input ="c:\\test.html";
$word->Documents->Open($input);
$word->ActiveDocument->PrintOut();
// closing word
$word->Documents[1]->Close(false);
$word->Quit();
// free the object
$word->Release();
$word = null;
unset($word);
?>