Do you have the option of printing through Word or something similar?

We had the same problem and ended up saving the file to a cache and
using COM objects to print to the default printer through Word.

The code looks a bit like this... Of course, it expects you to define
the $saveFile as the file it's trying to open.

<?
// initialize the word components
$word = new COM("word.application") or die("Unable to instantiate
Word");

print "Loaded word version ($word->Version)\n";
$word->visible = true;
$word->Documents->Add();
 
// open the file
$word->Documents->Open("$saveFile");

// output the file to the default printer
$word->ActiveDocument->PrintOut(1);

// shutdown word
$word->Quit();

?>

        -- jon

-------------------
jon roig
web developer
email: [EMAIL PROTECTED]
phone: 888.230.7557

-----Original Message-----
From: Lou Apolonia [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 05, 2004 6:02 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Printer Functions


My question involves sending html to the printer to be printed properly.
Here is my code:

$handle = printer_open('Lexmark Z25-Z35'); printer_start_doc($handle,
"test"); printer_start_page($handle);

printer_set_option($handle, PRINTER_MODE, 'raw');
printer_set_option($handle, PRINTER_PAPER_FORMAT,
PRINTER_FORMAT_LETTER); $file =
file_get_contents('http://localhost/'.$page.'.php?mid='.$mid);
printer_draw_text($handle, $file, 10, 10);

printer_end_page($handle);
printer_end_doc($handle);
printer_close($handle);

When this code runs, a page prints .. However all that prints is the
html source, and it only prints one line across the top of the page and
nothing else.  How does one send html to the printer and have the
rendered page print?

I've also tried using printer_write instead of printer_draw_text, but to
no avail.  

As always, any help is greatly appreciated.

Thank you in advance,
Lou

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to