Jump to content

Automated Printing from PHP/MySQL web form information


using PHP

Recommended Posts

Hello,

 

I am learning PHP to take information submitted in a web-form and store it in a MySQL database, but I also need it to automatically print to the laser printer I have setup. So that a notice or printout is produced of the information.

 

My question is... what route do I go to automate printing from web-based information in a PHP/MySQL database?

 

Is it PERL ? or does PHP have a feature to do this? I am willing do to the leg work and accomplish it, I just need some insight of which software technology is going to help me accomplish my goal.

I'm kinda reaching here, but look into cups (IF you're running Linux). Here's an overview of my theory:

 

1) use php's fsockopen with fputs to open a socket to the cups server

2) issue a command to print

 

What legwork you'll have to do:

1) research cups's commands that it can accept via the network, and what format they come in.

 

If the printer is hooked to your SERVER, you should be able to spool directly to print jobs on the command line without using socket connections.

 

If the printer is hooked to your CLIENT (the computer you're using to view these reports), you can invoke the print dialog in javascript when you need it, then just click "ok" and it will print.

 

-Dan

If the printer is hooked to your SERVER, you should be able to spool directly to print jobs on the command line without using socket connections.

i assume, by this, you mean using php's system() or exec() functions (you forgot to mention the HOW ;))?

Well, yeah, you and i know that, but this guy may not have, so i though that perhaps i'd be a bit more explicit for him.

 

Anyway here's some docs on command line options that he can call with exec or system:

 

http://www.cups.org/documentation.php/options.html

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.