Jump to content


Photo

Is there a way to set up an automated printing in PHP?


  • Please log in to reply
21 replies to this topic

#1 eldan88

eldan88

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationNew York

Posted 26 January 2013 - 05:04 PM

Hi,

I have a custom build online ordering website application, that lets people order food online. The order then get sent to the restaurants order managment web application, that I set on up on their computer. The only problem is that when a new food order comes in, they need to view the order and then manually print it.

Is there any possibility where I can write up a function, that will have the order manually print by it self when an order is sent? Something that will bypass the print window on a windows machine.

Edited by eldan88, 26 January 2013 - 05:04 PM.


#2 trq

trq

    Advanced Member

  • Administrators
  • 31,022 posts
  • LocationSydney, Australia.

Posted 26 January 2013 - 05:26 PM

Did you look in the manual?

http://php.net/printer

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.


#3 eldan88

eldan88

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationNew York

Posted 27 January 2013 - 02:46 PM

Did you look in the manual?

http://php.net/printer


No i haven't. But I will take a look at it right now. Thank you!

Edited by eldan88, 27 January 2013 - 02:47 PM.


#4 eldan88

eldan88

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationNew York

Posted 27 January 2013 - 02:57 PM

I have looked into the manuel and it said "These functions are only available under Windows 9.x, ME, NT4 and 2000"

Will they work for windows xp and above?

Did you look in the manual?

http://php.net/printer



#5 Psycho

Psycho

    Advanced Member

  • Gurus
  • 10,834 posts
  • LocationCanada

Posted 27 January 2013 - 03:05 PM

I'm fairly certain those functions only work on the server. So, unless you are hosting the site on a server in the restaurant they won't work. Trying to automatically print on a client browser would be a significant security risk. Could you imagine? Instead of all the popup advertising, all those internet advertisers would be trying to print to our printers.
The quality of the responses received is directly proportional to the quality of the question asked.

I do not always test the code I provide, so there may be some syntax errors. In 99% of all cases I found the solution to your problem here: http://www.php.net

#6 eldan88

eldan88

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationNew York

Posted 27 January 2013 - 05:17 PM

I'm fairly certain those functions only work on the server. So, unless you are hosting the site on a server in the restaurant they won't work. Trying to automatically print on a client browser would be a significant security risk. Could you imagine? Instead of all the popup advertising, all those internet advertisers would be trying to print to our printers.


You do make a point. Is there a way where I can set their machine up as a local host and do it that way?

#7 trq

trq

    Advanced Member

  • Administrators
  • 31,022 posts
  • LocationSydney, Australia.

Posted 27 January 2013 - 05:20 PM

Sorry, I misread your post and assumed the application was hosted in house.

Is there a way where I can set their machine up as a local host and do it that way?


Of course there is. But if you need to ask that questions, it's not likely you are the person to do it.

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.


#8 eldan88

eldan88

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationNew York

Posted 27 January 2013 - 07:39 PM

Sorry, I misread your post and assumed the application was hosted in house.



Of course there is. But if you need to ask that questions, it's not likely you are the person to do it.


What do you mean I don't follow?

#9 trq

trq

    Advanced Member

  • Administrators
  • 31,022 posts
  • LocationSydney, Australia.

Posted 27 January 2013 - 09:18 PM

Setting up a publicly accessible server poses numerous security risks. If your not sure of what your doing, I'm not sure I would recommend doing it.

It's up to you though. But yeah, of course it's possible.

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.


#10 Psycho

Psycho

    Advanced Member

  • Gurus
  • 10,834 posts
  • LocationCanada

Posted 27 January 2013 - 11:09 PM

You could set up the app in the remote server as it is now and set up a local server in the restaurant that will query the application every x minutes for new orders and, if any are found, print them out. But, it seems like a lot of complexity for something that can be easily resolved by a human simply checking for the orders
The quality of the responses received is directly proportional to the quality of the question asked.

I do not always test the code I provide, so there may be some syntax errors. In 99% of all cases I found the solution to your problem here: http://www.php.net

#11 PFMaBiSmAd

PFMaBiSmAd

    Advanced Member

  • Staff Alumni
  • 16,767 posts
  • LocationColorado, U.S.A.

Posted 27 January 2013 - 11:25 PM

I would have the server send the order to a fax machine at the restaurant through an Internet based fax service.
Signature: (not a comment about anything you posted unless specifically indicated)
Debugging step #1: To get past the garbage-out equals garbage-in stage in your code, you must check that the inputs to your code are what you expect.

Programming is just problem solving, but it is done in another language. You must learn enough of the programming language you are using to be able to read and write code.

#12 trq

trq

    Advanced Member

  • Administrators
  • 31,022 posts
  • LocationSydney, Australia.

Posted 27 January 2013 - 11:27 PM

People still use faxes?

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.


#13 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

Posted 28 January 2013 - 06:58 AM

You could set up the app in the remote server as it is now and set up a local server in the restaurant that will query the application every x minutes for new orders and, if any are found, print them out. But, it seems like a lot of complexity for something that can be easily resolved by a human simply checking for the orders


I get free food occasionally by placing an order online and expecting that a human on the other end will do their job correctly.
(Hint: humans fail. A lot.)
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.

How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq

Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!

#14 Barand

Barand

    Sen . ( ile || sei )

  • Gurus
  • 14,381 posts
  • LocationCheshire, UK

Posted 28 January 2013 - 07:19 AM

... they need to view the order and then manually print it.


I guess clicking the "Print this email" button is a bit much to ask of anyone.

moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts
|baaSelect| generate js and php code for dynamic linked dropdowns

 


#15 Christian F.

Christian F.

    Advanced Member

  • Staff Alumni
  • 3,106 posts
  • LocationNorway

Posted 28 January 2013 - 07:34 AM

Or just mail the printer? That is, if the printer is new enough to support this.
Keeping it simple.

#16 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

Posted 28 January 2013 - 09:06 AM

Or just mail the printer? That is, if the printer is new enough to support this.

That's a great option. And buying one that does support it would probably be the cheapest option in terms of time and money, if you want to automate it.
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.

How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq

Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!

#17 totallytech

totallytech

    Member

  • Members
  • PipPip
  • 17 posts

Posted 28 January 2013 - 10:16 AM

I agree with buying a printer, I bought a HP 3050a printer and using HP E-Print you can set up an email address, then you can simply cc email the orders to the new printers email address.

I have my fax number forwarding to an email address, which then prints out.

The printer was around £40GBP ($70USD) ish

So easy, I'm using the technology for other businesses which need to generate orders etc. :)

#18 Psycho

Psycho

    Advanced Member

  • Gurus
  • 10,834 posts
  • LocationCanada

Posted 28 January 2013 - 11:18 AM


You could set up the app in the remote server as it is now and set up a local server in the restaurant that will query the application every x minutes for new orders and, if any are found, print them out. But, it seems like a lot of complexity for something that can be easily resolved by a human simply checking for the orders

I get free food occasionally by placing an order online and expecting that a human on the other end will do their job correctly.
(Hint: humans fail. A lot.)


Right, but ultimately a human is required to process the order (at least in the case of a food order). Even if the order is printed it still requires a person to check the printer. You could have a web page that routinely checks for new order and changes the color of the page if there are new, unprocessed orders. That doesn't require creating a second webserver or any way out solutions. At least that's my opinion.
The quality of the responses received is directly proportional to the quality of the question asked.

I do not always test the code I provide, so there may be some syntax errors. In 99% of all cases I found the solution to your problem here: http://www.php.net

#19 eldan88

eldan88

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationNew York

Posted 03 February 2013 - 01:06 PM

Right, but ultimately a human is required to process the order (at least in the case of a food order). Even if the order is printed it still requires a person to check the printer. You could have a web page that routinely checks for new order and changes the color of the page if there are new, unprocessed orders. That doesn't require creating a second webserver or any way out solutions. At least that's my opinion.


Hey Physco,

I already have a web management application that is on their computer, which notifies the restaurant when a new food order has arrived. But its really annoying when you have to manually print each food order when it comes in the order management. Espically when you get 20 orders a day, and you are in the middle of a lunch hours. I want it to have the food orders automatically print, and have them confirm it.

A competitor of mine already has this, where every order that comes through their order management gets printed automatically. All i want is to have a file to be sent the the printer. Not necessarily have the actual browser print what ever it is is seeing on the screen.


Is there anyway I can have a file get sent to the printer, and bypass the print dialogue box?

#20 eldan88

eldan88

    Advanced Member

  • Members
  • PipPipPip
  • 490 posts
  • LocationNew York

Posted 03 February 2013 - 01:07 PM

I agree with buying a printer, I bought a HP 3050a printer and using HP E-Print you can set up an email address, then you can simply cc email the orders to the new printers email address.

I have my fax number forwarding to an email address, which then prints out.

The printer was around £40GBP ($70USD) ish

So easy, I'm using the technology for other businesses which need to generate orders etc. :)


I have over 100 clients. This would be out of the picture.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com