PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<systemprinter_abort>
view the version of this page
Last updated: Thu, 21 Aug 2003

LXXXV. Printer functions

Introduction

These functions are only available under Windows 9.x, ME, NT4 and 2000. They have been added in PHP 4.0.4.

Installation

Add the line extension=php_printer.dll to your php.ini file.

Runtime Configuration

The behaviour of these functions is affected by settings in php.ini.

Table 1. Printer configuration options

NameDefaultChangeable
printer.default_printer""PHP_INI_ALL
For further details and definition of the PHP_INI_* constants see ini_set().

Table of Contents
printer_abort -- Deletes the printer's spool file
printer_close -- Close an open printer connection
printer_create_brush -- Create a new brush
printer_create_dc -- Create a new device context
printer_create_font -- Create a new font
printer_create_pen -- Create a new pen
printer_delete_brush -- Delete a brush
printer_delete_dc -- Delete a device context
printer_delete_font -- Delete a font
printer_delete_pen -- Delete a pen
printer_draw_bmp -- Draw a bmp
printer_draw_chord -- Draw a chord
printer_draw_elipse -- Draw an ellipse
printer_draw_line -- Draw a line
printer_draw_pie -- Draw a pie
printer_draw_rectangle -- Draw a rectangle
printer_draw_roundrect -- Draw a rectangle with rounded corners
printer_draw_text -- Draw text
printer_end_doc -- Close document
printer_end_page -- Close active page
printer_get_option -- Retrieve printer configuration data
printer_list -- Return an array of printers attached to the server
printer_logical_fontheight -- Get logical font height
printer_open -- Open connection to a printer
printer_select_brush -- Select a brush
printer_select_font -- Select a font
printer_select_pen -- Select a pen
printer_set_option -- Configure the printer connection
printer_start_doc -- Start a new document
printer_start_page -- Start a new page
printer_write -- Write data to the printer


add a note add a note User Contributed Notes
Printer functions
macagomez at yahoo dot com
28-Jul-2003 04:35
Please notice that what is printed is NOT measured in pixels, it is measured in pronter's dots.
Apply to fonts, coordinates and bit maps.
HW
04-May-2003 05:31
Should be pretty obvious, but in case there is any confusion...
The printer in question is one that is connected to the _server_, not the _client_.
jwlash at acm dot org
20-Feb-2003 03:40
I have noticed the for unix based systems you can also do this:

system("lp $filename")

:)
surak at surak dot eti dot br
05-Feb-2003 02:30
[Editor's Note]
There is another free one available at http://www.fpdf.org/
[/Note]

As Bert said, a pdf generator wouldn't be bad. There is a free one at http://www.ros.co.nz/pdf/ , which can do the job. Inspite of the fact it is a little bit rough, it works fine and quite fast. It's just a matter of throwing the pdf file to ghostscript print it.
bertATnerdstockDOTorg
21-Jan-2003 08:22
If you want to address the printer from your PHP-application in a Un*x environment:
This is possible if you use a different method.
In Unix it would not be logical to address your printer directly from php, but you could for instance generate a PDF-file with PDFlib (or a textfile, or a PNG/JPEG image with GD or what have you) and write it from your php-script to a directory that you use as a "printer-outbox."

Next, you write a shellscript that calls some unix tool to print all pdf or other documents in your "outbox" directory and then deletes all files in that directory.

Then you use crontab to run this script every minute or as often as you think it's neccessary.

You could of course also call the shellscript from your php-application with exec() but you'll probably want to avoid using exec() and the like for security reasons.
kincaic at swbell dot net
22-May-2002 11:23
The X and Y co-ordinates are in dots. 

Get the printer resolution BEFORE printing anything and convert all co-orditantes to dots in the current resolution. 

Trying to change the resolution does NOT work in Win2000.

Anybody know where the source to php_printer.dll is kept?  I would like to fix some of the bugs that I have found.

<systemprinter_abort>
 Last updated: Thu, 21 Aug 2003
show source | credits | sitemap | mirror sites 
Copyright © 2001-2003 The PHP Group
All rights reserved.
This mirror generously provided by: http://php.mirrors.ilisys.com.au/
Last updated: Sat 01 Nov 2003 04:13:36 EST EST