vozzek Posted August 27, 2008 Share Posted August 27, 2008 Hi all, I've got a php script that builds a nice (html formatted) $message variable and sends it to the customer via email. This is basically an invoice. What I'd like is to send that exact invoice to my local printer. Nothing fancy, I just want to shoot that variable to my printer. I've tried the following: $handle = printer_open(); printer_set_option($handle, printer_MODE, "raw"); printer_write($handle, $message); printer_close($handle); It doesn't print, instead I get: Fatal error: Call to undefined function printer_open() I thought maybe I needed to name the printer, so I replaced the first line with: $handle = printer_open("HP LaserJet 3050 Series PCL 6"); Still no dice. I was reading somewhere that I might need to install a .dll file or change my php.ini? I'm not sure how to do this. Is there a simple way to do what I'm looking for? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
discomatt Posted August 27, 2008 Share Posted August 27, 2008 http://php.net/manual/en/printer.installation.php Quote Link to comment Share on other sites More sharing options...
vozzek Posted August 27, 2008 Author Share Posted August 27, 2008 Okay, thanks. How do I access my php.ini file, and is it possible to do this if my site is being hosted by HostGator? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted August 27, 2008 Share Posted August 27, 2008 The printer functions only work on Windows servers. They do not print to your local printer, but to printers attached to the server. Ken Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 27, 2008 Share Posted August 27, 2008 Or just: `lpr '$filename'` Quote Link to comment Share on other sites More sharing options...
DyslexicDog Posted August 27, 2008 Share Posted August 27, 2008 You could just email a copy to yourself and print if necessary. Quote Link to comment Share on other sites More sharing options...
vozzek Posted August 27, 2008 Author Share Posted August 27, 2008 You could just email a copy to yourself and print if necessary. A good idea, and this is what I'm doing now. I just kinda thought this would be a lot simpler than it is. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 27, 2008 Share Posted August 27, 2008 Are you on Windows or Linux? Quote Link to comment Share on other sites More sharing options...
vozzek Posted August 27, 2008 Author Share Posted August 27, 2008 I'm working on Windows XP. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 27, 2008 Share Posted August 27, 2008 I'm working on Windows XP. Never mind then. <subliminal>P.S: Switch to Linux</subliminal> Quote Link to comment Share on other sites More sharing options...
discomatt Posted August 27, 2008 Share Posted August 27, 2008 You can use javascript to bring up the print dialog. Simply output the 'pretty email' content to the browser, and call the javascript function. Quote Link to comment Share on other sites More sharing options...
vozzek Posted August 27, 2008 Author Share Posted August 27, 2008 Can't talk right now... gotta go get Linux... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.