Sending Stream File Directly to Printer

The place for general PHP questions and hints for PHP on IBM i

Sending Stream File Directly to Printer

Postby jord1322 on Tue Jul 07, 2015 8:55 pm

Hello,

I'm working on an App that needs to take a file, specifically a PDF in its case, and send it to the printer to print. I've looked around to find out how this is accomplished with little luck.

Specifically what I need is the ability to bypass the need to open the PDF file, click the print option in the PDF and then confirm the print. I need them to be able to click print and it handles the rest, as they made the decision by clicking on the link.

I ran upon a method that I believe purports to accomplish this using printer_open() and sending it the printer name on a server, however, I soon came to find it required a PECL extension which I cannot seem to find. The page about the extension on PECL's site seems to not have the extension available and when I go back to find the information on php.net about the printer_open() function it no longer seems present (I may have stumbled on a previous version/language page though a search).

Either way our Zend Server 6 does not seem to have the PECL Printer extension installed and I'd like to find a way to get it if possible, or if someone knows of an alternative that would be great. Any help is appreciated.
Thanks,
Jordon Greene
PHP Full Stack Developer
SHOE SHOW, Inc.
jord1322
 
Posts: 34
Joined: Mon Nov 03, 2014 3:49 pm
Location: Concord, North Carolina

Re: Sending Stream File Directly to Printer

Postby scottgcampbell on Thu Jul 09, 2015 4:22 pm

I've done this several different ways but it really depends on the abilities of the printer and the setup in relation of the "app" and the printer.
1 - Is the printer locally connected (PC "app") or networked?
2 - Does the printer support FTP?
3 - Does the printer support IPP?

Scott
scottgcampbell
 
Posts: 187
Joined: Wed Apr 22, 2009 2:29 pm
Location: Edmonton, AB, Canada

Re: Sending Stream File Directly to Printer

Postby jord1322 on Fri Jul 10, 2015 2:36 pm

1. Yes, locally connected Printer.
2. No
3. No

We have managed to use a program call to print on our networked printers, but the local printers are the ones we cannot get it to work for.
Thanks,
Jordon Greene
PHP Full Stack Developer
SHOE SHOW, Inc.
jord1322
 
Posts: 34
Joined: Mon Nov 03, 2014 3:49 pm
Location: Concord, North Carolina

Re: Sending Stream File Directly to Printer

Postby scottgcampbell on Fri Jul 10, 2015 2:54 pm

I'd say that is not possible unless you are in a very controlled environment (if you are talking about a controlling all the PCs that are using your APP, in an office for example). Otherwise there is NO way for the server (PHP) to send the file to the printer on the PC (security nightmare or configuration nightmare having to setup software on each PC). Possibly you could set something like google cloud print up (https://www.google.com/cloudprint#printers) or print from the browser using javascript (http://stackoverflow.com/questions/16239513/print-pdf-directly-from-javascript) but I'm not sure that is what you are looking to do.

If you do find a way to do it please let me know I like hearing how challenges like this are solved :)

Scott
scottgcampbell
 
Posts: 187
Joined: Wed Apr 22, 2009 2:29 pm
Location: Edmonton, AB, Canada


Return to PHP Questions / Hints

Who is online

Users browsing this forum: No registered users and 3 guests