PHP: printer_open - Manual

downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

printer_select_brush printer_logical_fontheight

Last updated: Sat, 27 Jan 2007

view this page in

# printer_open

(PECL)

printer_open -- Open connection to a printer

## Description

resource printer_open ( [string devicename] )

This function tries to open a connection to the printer `devicename`, and returns a handle on success or `FALSE` on failure.

If no parameter was given it tries to open a connection to the default printer (if not specified in `php.ini` as `printer.default_printer`, PHP tries to detect it).

printer_open() also starts a device context.

Пример 1. printer_open() example

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

add a note User Contributed Notes
printer_open
knightcon at bluebottle dot com
14-Dec-2006 05:04
`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.`
philip
29-Mar-2005 02:39
`This function may also return NULL on failure, instead of FALSE.`
jt at jtis dot de
31-Aug-2004 03:39
`Revision: Single quotes DO work, but with a triple slash, like
printer_open('\\\SERVERNAME\PRINTERNAME');
Weird.`
jasonlam_ at hotmail dot com
04-Jun-2003 04:22
`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 at iastate dot edu
30-Apr-2002 07:38
`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`
add a note
printer_select_brush printer_logical_fontheight

Last updated: Sat, 27 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 10:36:09 2007 PST