NYCPHP Meetup

NYPHP.org

[nycphp-talk] Re: Automatically Print Pages

Rolan Yang rolan at omnistep.com
Wed Dec 20 16:22:50 EST 2006


What operating system and web client are you using? I did something like 
this a few months ago. Opened the content in a separate hidden window 
then used javacript "window.Print" then closed the window after it was 
done. It's not completely reliable. If I remember correctly, it worked 
with some versions of IE (circumventing the printer dialog box), but not 
Firefox or Opera browser.

I think what we ended up doing was (and this is on a windows system), 
creating a unique mime type and configuring windows and the browser to 
run a batch file. When that mime type was detected, a  batch file was 
run which copied the downloaded file to lpt1. Essentially dumping the 
contents to the printer. You could probably use the DOS commant line 
"print /d:LPT1: c:\temp\temporary file" to do the same.
This will work if you are dumping something like raw data to a label 
printer.

Other odd situations arose also. On some machines, the default mime type 
stuck after the initial selection and we were not able to change it 
back. It's been a while so I don't remember all the problems, but at 
least you have a general idea in which direction to travel now.

Good luck,
Rolan

Felix Shnir wrote:
> This isn't possible with plain vanilla JS.  You'd need to look into 
> ActiveX controls, even then it might not be possible...
>
> Felix.
>
>
> On 12/20/06, * Joseph Crawford* <codebowl at gmail.com 
> <mailto:codebowl at gmail.com>> wrote:
>
>     Ok so i misunderstood the actual requirement.
>
>     THe page would have to print on the client machine as there are
>     many machines running the scan guns.  I am assuming i would need
>     Javascript for this task but i am not sure if there are any
>     libraries out there for this already.
>
>     We would want to print the page to the default printer completely
>     bypassing the print dialog that pops up.
>
>     Any assistance will be appreciated.
>
>     Thanks,
>     Joseph Crawford
>
>
>     On 12/20/06, *Joseph Crawford* <codebowl at gmail.com
>     <mailto:codebowl at gmail.com>> wrote:
>
>         Ok Guys & Gals,
>
>         I know i have seen talk on this subject before (or similar)
>         but i never had a use for it until now.
>
>         My fulltime employer has their warehouse application written
>         in PHP controlled with scan guns, etc.
>         When they pack an order they scan the barcodes and it
>         processes the order.  The script then generates a PDF and
>         currently redirects to the PDF so that it will
>         open in the browser.  They can then hit print to print the page.
>
>         We would like to streamline this a bit more.  Rather than
>         redirect to the PDF we would like the PHP script actually send
>         the PDF directly to the printer.  I know you can
>         do this as i recall someone doing it with a DYNAMO labeler.
>
>         The question is where can i read up on this topic.  We would
>         need to send this off to the default printer port.
>
>         Any insight would be a great help.
>
>         Thanks,
>         -- 
>         Joseph Crawford Jr.
>         Zend Certified Engineer
>         Codebowl Solutions, Inc.
>         http://www.codebowl.com/
>         Blog: http://www.josephcrawford.com/
>         1-802-671-2021
>         codebowl at gmail.com <mailto:codebowl at gmail.com> 
>
>
>
>
>     -- 
>     Joseph Crawford Jr.
>     Zend Certified Engineer
>     Codebowl Solutions, Inc.
>     http://www.codebowl.com/
>     Blog: http://www.josephcrawford.com/
>     1-802-671-2021
>     codebowl at gmail.com <mailto:codebowl at gmail.com>
>
>     _______________________________________________
>     New York PHP Community Talk Mailing List
>     http://lists.nyphp.org/mailman/listinfo/talk
>
>     NYPHPCon 2006 Presentations Online
>     http://www.nyphpcon.com <http://www.nyphpcon.com>
>
>     Show Your Participation in New York PHP
>     http://www.nyphp.org/show_participation.php
>     <http://www.nyphp.org/show_participation.php>
>
>
>
>
> -- 
> Felix
> -------------------------
> God put me on earth to accomplish a certain number of things.  Right 
> now, I'm so far behind, I will never die...
> ------------------------------------------------------------------------
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php



More information about the talk mailing list