For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > February 2005 > Printer functions









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Printer functions
Fotis Andritsopoulos

2005-02-21, 8:56 am

Hello,

I tried to find out how can I print a document through php. What I want,
is to add a "print button" within a web page (something like the "Print"
button of the explorer, but within the page).
I tried a little bit with the printer_open() function of php but with no
luck. I red the docs, but I couldn't understand which functions are
required to print.

printer_open();
.... what else ???
printer_close();

Thanks a lot!

Fotis.
Matt Mitchell

2005-02-21, 8:56 am


"Fotis Andritsopoulos" <fandrit@telecom.ntua.gr> wrote in message
news:cvc4op$300p$2@ulysses.noc.ntua.gr...
: Hello,
:
: I tried to find out how can I print a document through php. What I want,
: is to add a "print button" within a web page (something like the "Print"
: button of the explorer, but within the page).
: I tried a little bit with the printer_open() function of php but with no
: luck. I red the docs, but I couldn't understand which functions are
: required to print.

printer_open() is designed for printing *on the server*.

What you need to do, is create a printable layout for the page, and you can
always add a print facility using javascript.

Matt


Fotis Andritsopoulos

2005-02-21, 8:56 am

Ok. You 're right. This is what I mean. I want the client to print on
the server's printer. I have found some scripts that "prepare" the page
as printer friendly. However, I do not want to use javascript but only
php. The reason for that, is because I do not want *any* type of
processing on the client. Is this possible ?

Thanks,

Fotis.
> printer_open() is designed for printing *on the server*.
>
> What you need to do, is create a printable layout for the page, and you can
> always add a print facility using javascript.
>
> Matt
>
>

Matt Mitchell

2005-02-21, 8:56 am

"Fotis Andritsopoulos" <fandrit@telecom.ntua.gr> wrote in message
news:cvc5i8$12u$1@ulysses.noc.ntua.gr...
: Ok. You 're right. This is what I mean. I want the client to print on
: the server's printer. I have found some scripts that "prepare" the page
: as printer friendly. However, I do not want to use javascript but only
: php. The reason for that, is because I do not want *any* type of
: processing on the client. Is this possible ?
:

For printing on the server, you *would* use the printer_xxx functions

BUT

only on Windows!...

Personally, I'd generate a PDF file from the script, and then you can print
that using an external command, called from the script.

http://php.net/ref.pdf.php

Matt


Fotis Andritsopoulos

2005-02-21, 8:56 am

> For printing on the server, you *would* use the printer_xxx functions
>
> BUT
>
> only on Windows!...

Matt, the platform is Windows so I don't think that there is a problem
about this. The printer will be a portable thermal printer. Do you
believe that this is a problem ? The configuration will look like that:

thermal_printer <-> Win_PC(web,php,db) <-IP/802.11b-> Windows_CE_PDA

I think that the easiest way would be a well formatted (printer
friendly) web page that it will be printed directly to the "shared"
printer on Win_PC. But I don't know if this is possible (avoiding
producing a pdf doc.)

Fotis.
>
> Personally, I'd generate a PDF file from the script, and then you can print
> that using an external command, called from the script.
>
> http://php.net/ref.pdf.php
>
> Matt
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com