Search code examples
phpnetwork-printers

Unattended printing a document on a network printer


We're trying to have a master document (after an automated mailmerge) be sent, in an automated fashion, to one of our network printers which has both a network name and internal IP assigned.

But here's the really tricky part. When we print a document from our workstations we do get prompted with a 'Job Accounting' dialog to enter the project code that the document is for before it'll print, so the finance department can do all their fancy accounting and billing stuff.

So, how do we send a document (docx) to a network printer along with the Job Accounting parameter programmatically?

I am not sure how common accounting data is when doing print jobs, as this is the first job I've ever seen it.

Here are the important specifics:

  • PHP 5 (preferred)
  • Windows Server (2003, I believe)
  • Kyocera KM-4050 Printer (w/ static IP)
  • Some experience with C++ and Visual Basic

We've done some research but haven't found too many viable solutions out in the wild and after some discussion, we're not entirely sure where to start. Unfortunately, there does not appear to be any kind of API we can plug into.

----- SOLUTION -----

My team has decided to implement code that will call an executable file to convert each document to PCL and then to take the generated PCL and prepend it with

@PJL SET KJOBMANAGERCODE="[project code here]"

Then we will take the generated file and write it to the printer spool where the printer will process it and start each job.

Thank you all for your help. Each answer pretty much inspired a certain part of our implementation plan.


Solution

  • My team has decided to implement code that will call an executable file to convert each document to PCL and then to take the generated PCL and prepend it with

    @PJL SET KJOBMANAGERCODE="[project code here]"

    Then we will take the generated file and write it to the printer spool where the printer will process it and start each job.

    Thank you all for your help. Each answer pretty much inspired a certain part of our implementation plan.