Page 1 of 1

[SOLVED] Printing to a netwokr printer an HTML page!

Posted: Sun Feb 13, 2005 3:01 am
by pelegk2
at last i did it wit lot's of thanks too :
http://il.php.net/manual/en/ref.com.php
and look at : angelo [at] mandato <dot> com ->remarks!!!!
first yoou need :
// msword.inc.php

// 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

and then :

Code: Select all

<?

// You must have word and adobe acrobat distiller on
// your system, although theoretically any printer driver
// that makes .PS files would work.

// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
print "Loaded Word, version &#123;$word->Version&#125;\n";

// bring it to front
$word->Visible = 0;
//this is for example a printer on my network
$word->ActivePrinter = "\\\\192.168.4.206\\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&#1111;1]->Close(false);
$word->Quit();

// free the object
$word->Release();
$word = null;
unset($word);


?>

Posted: Sun Feb 13, 2005 3:13 am
by feyd
what's wrong with just calling window.print() ?

the diffrence is that the user

Posted: Sun Feb 13, 2005 3:17 am
by pelegk2
send's ts to a printer on the web
for example like an inforamtion station where you dont want to opne the user a printer dilaog box so you send it directly when he ask's to print!

Posted: Sun Feb 13, 2005 3:21 am
by feyd
so instead you launch word and acrobat instead on the server.. all right.

kinda seems like a waste of 2 software licenses to me.. :?

i idnt use acrobat reader

Posted: Sun Feb 13, 2005 3:34 am
by pelegk2
i forgot to delete that remark:)

and the word application i have it any way beacuse i work with it:)