Auto Printing using Apache/PHP/JavaScript

theknight571

Platinum Member
Mar 23, 2001
2,896
2
81
The setup:

We're running on an intranet, so I have control over the browsers being used. :)

The Server is a Windows 2003 Server, with Apache and PHP 5.0.5.

The printer I want to print to is setup as the default printer on the server.


The problem:

A client comes into our office and completes a form on our "sign-in" computers, they also complete a paper form (this was implemented long before I got here... so don't ask. :) )
that is used by our back-office for pulling the file(s).

The PHP behind the form saves the data to a MySQL database.

I would like to eliminate having to have the client also fill out a paper form. So I thought, why not just have the program print the form for the back-office.

However, I can't seem to figure out how to do this?

I'm "googleing" as we "speak"... but figured I'd ask the AT collective while I was searching.

Any help is appreciated.

Thanks.

 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,835
4,815
75
It sounds like you're trying to have the server print, which may be the more difficult angle. If it's only a few locked-down "sign-in" computers that would be used to fill in the form, can you configure them to print only to that back-office printer? Then just display the form with a Javascript print button.
 

theknight571

Platinum Member
Mar 23, 2001
2,896
2
81
Originally posted by: Ken g6
It sounds like you're trying to have the server print, which may be the more difficult angle. If it's only a few locked-down "sign-in" computers that would be used to fill in the form, can you configure them to print only to that back-office printer? Then just display the form with a Javascript print button.

I've figured out a couple of different ways I could have someone hit print to print the form.

I was shooting for just having the form print automatically, without any user interaction.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
A client comes into our office and completes a form on our "sign-in" computers, they also complete a paper form (this was implemented long before I got here... so don't ask. )
that is used by our back-office for pulling the file(s).

The PHP behind the form saves the data to a MySQL database.

Your PHP code is running on the server, why can't it create a new print job after it saves to MySQL?
 

drebo

Diamond Member
Feb 24, 2006
7,034
1
81
THere are a number of ways to do this...

Drakkon's is the easiest.

Alternatively, there are 3rd party utilities that will watch a folder and print whatever drops into it...so if you need something with pretty formatting, etc, you can have PHP spit out an HTML document to that folder and then this third-party utility will automatically print it.

PHP, by itself, however, cannot print.
 

theknight571

Platinum Member
Mar 23, 2001
2,896
2
81
Originally posted by: DaveSimmons
A client comes into our office and completes a form on our "sign-in" computers, they also complete a paper form (this was implemented long before I got here... so don't ask. )
that is used by our back-office for pulling the file(s).

The PHP behind the form saves the data to a MySQL database.

Your PHP code is running on the server, why can't it create a new print job after it saves to MySQL?

Well... I figured that much. lol

I can create the file I want to print, but I wasn't sure how to get it to the printer.

I'll be looking into Drakkon and drebo's suggestions.

Thanks for everyone's help.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Well... I figured that much. lol
I've figured out a couple of different ways I could have someone hit print to print the form.
I was shooting for just having the form print automatically, without any user interaction.

Just checking. It sounded like you might be trying to write some weird client-side javascript to do it instead of running a script or exe from the server-side PHP, so I wondered if there was some reason why you weren't just asking "how do I print from PHP?" :)