note 49953 modified in ref.com by danbrown
| From: | danbrown@php.net | Date: | Mon, 21 Dec 2009 17:09:05 +0000 |
| Subject: | note 49953 modified in ref.com by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164208@lists.php.net to get a copy of this message | ||
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);
?>
--was--
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
// 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);
its based on :
at last i did it with lot's of thanks too :
http://il.php.net/manual/en/ref.com.php
http://php.net/manual/en/ref.com.php