943,568 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 90999
  • PHP RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Feb 7th, 2005
0

Re: How To Print Directly to Printer

Quote originally posted by xiaolee ...
I guess the very first issue here is, PHP will be installed in your server. And there might be 2 issue, one is using WIN OS, and the other might be unix based os.
I know you can make use of LINUX command in PHP to trigger the printing. You can alos use normal DOS COMMANF in PHP if you are running WIN OS. It is simply the lineprint command or copy to lpt port. but I wouldn't know how can you track with the NETWORK Printer is ready, and able to print. Hope this does help. regarding the phpprinter command, it is only able to run in WINDOWS environment.
can you elaborate a bit more of the how to lineprint to copy to lpt port ? pardon me for my ignorance.

btw, POA i'm running win XP, it seems that the functions listed there does not support win xp... although someone posted on the user contribution that it can actually be used on XP too. tried email-ing the person but to no response. http://my.php.net/manual/en/ref.printer.php
Reputation Points: 10
Solved Threads: 0
Newbie Poster
chunguy is offline Offline
24 posts
since Sep 2004
Feb 7th, 2005
0

Re: How To Print Directly to Printer

Say after me: you can not access hardware on the client machine from a serverside application or script.

You CAN print from your serverside application to any printer which is attached to the server (if PHP supports that...), but never to the client.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Apr 27th, 2005
0

Re: How To Print Directly to Printer

Oh yes you can...

Of course PHP can print to a printer linked to the server. It's called an intranet! Most PHP is coded as internal utilities within companies... not on external websites. Try the PECL php_printer.dll install and then use the print functions. On Unix just do a system('lpr')...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gmalcolm is offline Offline
1 posts
since Apr 2005
Dec 28th, 2006
0

Re: How To Print Directly to Printer

Click to Expand / Collapse  Quote originally posted by cscgal ...
I don't believe this is possible as PHP is a scripting language, and therefore doesn't have the ability to gain control of hardware directly. For example, you wouldn't be very happy if you were surfing the web and various PHP-driven sites had direct access to your hard drive and hardware! What you're looking for should be possible through ActiveX controls. ActiveX controls are mini-programs (??) that are downloaded automatically over the Internet ... such as the way that the Windows Update website has control to install software to your hard drive automatically. Not sure how they work though ... that's a Microsoft thing.
Visual basic can produce activex programs
Reputation Points: 10
Solved Threads: 0
Newbie Poster
stoopidnerd is offline Offline
2 posts
since Dec 2006
Oct 30th, 2008
0

Re: How To Print Directly to Printer

you can print directly to a printer held on the clients machine. the php_printer.dll is needed which can be found in the PECL downloads.

once you have downloaded and copyed the php_printer.dll into your extensions folder i.e. c:\php\ext edit the php.inin in c:\php\ and add a line extension=php_printer.dll line in the extensions section, re start iis or apache webserver.

Check that the php extensions has loaded by creating a info.php file containing
php Syntax (Toggle Plain Text)
  1. <?php
  2. phpinfo();
  3. ?>

scroll down for printer settings this will determine that the extensions is initialised correctly

Then on the php.net website do a search for printer_set_option for printer function and you will see all the printer fuctions that php has to offer.
Reputation Points: 14
Solved Threads: 0
Newbie Poster
psycho007 is offline Offline
23 posts
since Oct 2008
Nov 3rd, 2009
0

Was this issues solved?

Hi I am faced with a similar problem where I'd like to eliminate the additional step of the print dialog box and have php select and sent the print job to the appropriate printer. I was wondering if anyone found a solution to this problem ...

Thank you for your help!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
achunawala is offline Offline
1 posts
since Nov 2009
Jan 14th, 2010
0
Re: How To Print Directly to Printer
Dear psycho007 ...
I want to ask u that this solution is for localhost or it can be functional over the linux server (online not on localhost)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sadaf786 is offline Offline
1 posts
since Jan 2010
Feb 7th, 2010
0
Re: How To Print Directly to Printer
hai friends ,
am doing standalone project by localhost(client & server inthe same machine),i need to print the content from the database to printer continously (billing process).printer is dotmatrix printer,how to print one record print in the onesheet and another record print in next sheet ,am using [php ,mysql,javascript] language for code

thanking u,
J.JAGAN
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jaha.j is offline Offline
1 posts
since Feb 2010
Mar 31st, 2010
1

ActiveX = Viruses

Click to Expand / Collapse  Quote originally posted by cscgal ...
I don't believe this is possible as PHP is a scripting language, and therefore doesn't have the ability to gain control of hardware directly. For example, you wouldn't be very happy if you were surfing the web and various PHP-driven sites had direct access to your hard drive and hardware! What you're looking for should be possible through ActiveX controls. ActiveX controls are mini-programs (??) that are downloaded automatically over the Internet ... such as the way that the Windows Update website has control to install software to your hard drive automatically. Not sure how they work though ... that's a Microsoft thing.
This is the mechanism that allows IE to infect computer with viruses.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
aaln is offline Offline
8 posts
since Sep 2009
Jul 16th, 2010
1
Re: How To Print Directly to Printer
I'm sorry to bump this thread.

I've done an application that can print to a client on LAN. It is a barcode labeling system that has maximum of 4 clients that do the printing, and few others that handles data.

you can actually open a network printer via this:

PHP Syntax (Toggle Plain Text)
  1. printer_open("\\\\client.ip.address\\sharename");

and send printer commands to it given these requirements:

1. apache (php on apache) is run by a normal user that has network privilege and has access to the lan printer. (To make it complicated, I set that user's username and password available to every client that has printing job. That is because Windows XP SOMETIMES denies access to shared resource whatever permission you set.)

2. php printer extension is installed.

Of course the server must know where to print. I've done this by having a printer database for each client along with the printer share name.

Our application has been running already a year.

PS: It is error prone (network / windows issues)
Last edited by lysender; Jul 16th, 2010 at 6:12 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
lysender is offline Offline
3 posts
since Jul 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Virtuemart Add to Cart Error
Next Thread in PHP Forum Timeline: Upload Video in php





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC