Re: [PHP] Access a printer via PHP

2001-02-08 Thread Ankur Verma

You cannot directly access a printer from a php script.

but you can try locating a a command line utility which will print the data
provided to it in the command line or a the contents of a filename provided
in the command line to the printer connected to the server. If the data is
quite large ( in the sense let's say a reciept as it seems in your case),
you might write the data to a temporary file and pass the filename to the
priniting utility using the exec() command in PHP.

You can obviously make the updates to teh database on the pHP page and call
the exec() command once the transaction is completed..

hope that helps

Ankur Verma
HCL Technologies Ltd,
A1CD, Sector16, Noida
UP, India



- Original Message -
From: "ThoVer Webproducties" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 07, 2001 7:02 PM
Subject: [PHP] Access a printer via PHP


> Hello,
>
> For an e-commerce project we want to connect
> the mySQL-database we created to a printer
> (attached to a computer which has 24h
> internet [and mySQL database] access). I
> assume it's different to couple the
> mySQL-database directly to a printer.
> We are however accessing the database via
> PHP, so I think it might be possible to send
> a command to a printer directly from the PHP
> file which puts the data into the database as
> well.
>
> We want to do this in order to have an order
> via the website printed directly. In fact,
> the printer should start printing as soon as
> an order is added to the seperate table in
> the mySQL database (by a special PHP
> document).
>
> Does anyone know whether this is possible
> and, if it's possible, could you tell me how?
>
>
>
>
> Thanks in advance,
> Thomas.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Access a printer via PHP

2001-02-07 Thread Foley, John



Make your PHP script push an HTML formatted tmp file, run it through
html2ps, (then perhaps ghostscript to make it PCL et al) and redirect it to
your printer. (Or, then run ps2pdf on it and also email a PDF order
confirmation page to your customer . . . the potential is limitless.)

You could skip several steps by writing the PS/PCL handler template
class yourself, but that's a lot of work.



Or . . . you could make a gif using GD primitives and your data,
then push this to ghostscript for PDF or postscript or PCL or bubblejet . .
.






John T. Foley
Network Administrator
Pollak Engineered Products, Actuator Products Division, A Stoneridge
Company
195 Freeport Street, Boston MA 02122
ph: (617) 474-7266fax: (617) 282-9058

  The geographical center of Boston is in Roxbury.  Due north of
the center we find the South End. This is not to be confused with South
Boston which lies directly east from the South End.  North of the South
End is East Boston and southwest of East Boston is the North End.

 

> -Original Message-
> From: Cal Evans [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, February 07, 2001 10:22 AM
> To:   ThoVer Webproducties; [EMAIL PROTECTED]
> Subject:      RE: [PHP] Access a printer via PHP
> 
> Thomas,
> 
> You don't connect databases to printers.  As you discerned, you could use
> a
> program to query the database and output the results to a printer.
> 
> I f you absolutely MUST have it start printing AS SOON as the order is
> inserted into the database (and I challenge you to re-think that
> requirement) then the PHP script that adds it to the database needs to
> also
> output it to the printer.  This might be the easiest way anyhow.
> 
> Sorry, I've never tried to print from PHP so I don't know the specifics
> but
> one possible way to do it would be to open a file handle to your printer
> and
> write to it like it were any other file.  My preference would be to write
> the order out to a file and then issue a system command to print that
> file.
> 
> Cal
> http://www.calevans.com
> 
> 
> -Original Message-
> From: ThoVer Webproducties [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 07, 2001 7:33 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Access a printer via PHP
> 
> 
> Hello,
> 
> For an e-commerce project we want to connect
> the mySQL-database we created to a printer
> (attached to a computer which has 24h
> internet [and mySQL database] access). I
> assume it's different to couple the
> mySQL-database directly to a printer.
> We are however accessing the database via
> PHP, so I think it might be possible to send
> a command to a printer directly from the PHP
> file which puts the data into the database as
> well.
> 
> We want to do this in order to have an order
> via the website printed directly. In fact,
> the printer should start printing as soon as
> an order is added to the seperate table in
> the mySQL database (by a special PHP
> document).
> 
> Does anyone know whether this is possible
> and, if it's possible, could you tell me how?
> 
> 
> 
> 
> Thanks in advance,
> Thomas.
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Access a printer via PHP

2001-02-07 Thread Cal Evans

Thomas,

You don't connect databases to printers.  As you discerned, you could use a
program to query the database and output the results to a printer.

I f you absolutely MUST have it start printing AS SOON as the order is
inserted into the database (and I challenge you to re-think that
requirement) then the PHP script that adds it to the database needs to also
output it to the printer.  This might be the easiest way anyhow.

Sorry, I've never tried to print from PHP so I don't know the specifics but
one possible way to do it would be to open a file handle to your printer and
write to it like it were any other file.  My preference would be to write
the order out to a file and then issue a system command to print that file.

Cal
http://www.calevans.com


-Original Message-
From: ThoVer Webproducties [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 07, 2001 7:33 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Access a printer via PHP


Hello,

For an e-commerce project we want to connect
the mySQL-database we created to a printer
(attached to a computer which has 24h
internet [and mySQL database] access). I
assume it's different to couple the
mySQL-database directly to a printer.
We are however accessing the database via
PHP, so I think it might be possible to send
a command to a printer directly from the PHP
file which puts the data into the database as
well.

We want to do this in order to have an order
via the website printed directly. In fact,
the printer should start printing as soon as
an order is added to the seperate table in
the mySQL database (by a special PHP
document).

Does anyone know whether this is possible
and, if it's possible, could you tell me how?




Thanks in advance,
Thomas.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Access a printer via PHP

2001-02-07 Thread ThoVer Webproducties

Hello,

For an e-commerce project we want to connect
the mySQL-database we created to a printer
(attached to a computer which has 24h
internet [and mySQL database] access). I
assume it's different to couple the
mySQL-database directly to a printer.
We are however accessing the database via
PHP, so I think it might be possible to send
a command to a printer directly from the PHP
file which puts the data into the database as
well.

We want to do this in order to have an order
via the website printed directly. In fact,
the printer should start printing as soon as
an order is added to the seperate table in
the mySQL database (by a special PHP
document).

Does anyone know whether this is possible
and, if it's possible, could you tell me how?




Thanks in advance,
Thomas.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]