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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

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

Post 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);


?>
Last edited by pelegk2 on Sun Feb 13, 2005 3:39 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what's wrong with just calling window.print() ?
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

the diffrence is that the user

Post 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!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.. :?
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

i idnt use acrobat reader

Post by pelegk2 »

i forgot to delete that remark:)

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