Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.