Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Printer Functions : printer_open

printer_open

Opens a connection to a printer ()
resource printer_open ( [string printername] )

Example 2003. printer_open() example

<?php
$handle
= printer_open("HP Deskjet 930c");
$handle = printer_open();
?>

Code Examples / Notes » printer_open

philip

This function may also return NULL on failure, instead of FALSE.

jt

Revision: Single quotes DO work, but with a triple slash, like
printer_open('\\\SERVERNAME\PRINTERNAME');
Weird.


knightcon

If you are desperate to do server-side printing with PHP on a *nix machine then you can always use the fsockopen() function and send a pre-build PJL (Printer Job Language) string directly to the printer. As long as your printer supports PJL then there should be no problem. Just also bare in mind that unless you are doing something very special, like sending the print job to a remote printer and not the printer the client is at you should just make a report page generated by php and apply a css stylesheet which makes the page styled for printing.

jasonlam_

Connecting to Network Printers
<?php
  $handle = printer_open("\\\\DOMAIN_NAME\\Printer_Name");
?>
Similiar to how you would locate a domain on your network
you need to have 2 prefix slashes.  But as reminder
you need to escape it.  So really you need 4 slashes.  It
worked me. Hopefully this helps who is having problems
connecting to network printer.


csammis

As stated on the index page for all the printer functions, these are supported under Win32 *only*...in fact, they're frontends API calls. I'd go ahead and say that they would probably never be ported to *nix because of the many various ways of handling printers. Windows, for all its faults, at least has a unified printing system.
As to editing the php.ini, try it with no path at all, like the first example here


Change Language


Follow Navioo On Twitter
printer_abort
printer_close
printer_create_brush
printer_create_dc
printer_create_font
printer_create_pen
printer_delete_brush
printer_delete_dc
printer_delete_font
printer_delete_pen
printer_draw_bmp
printer_draw_chord
printer_draw_elipse
printer_draw_line
printer_draw_pie
printer_draw_rectangle
printer_draw_roundrect
printer_draw_text
printer_end_doc
printer_end_page
printer_get_option
printer_list
printer_logical_fontheight
printer_open
printer_select_brush
printer_select_font
printer_select_pen
printer_set_option
printer_start_doc
printer_start_page
printer_write
eXTReMe Tracker