0

I have created one python based web-application. Basically the application is printing the customer bills as per their purchase. So I have created bill format but not sure how to print that by clicking on button print which i have added in page. My requirement here is when I click on that print button of my application then the bill should be printed from printer. If anyone having idea about the steps how should i process to solve this please feel free to add comments.

John
  • 11
  • 3
  • you say it's a 'web' application - where is the printer connected? to the end-user's computer? to the web server? the 'end user' and web server are the same computer? – Anentropic Oct 19 '15 at 09:40
  • the web browser already has a built-in print function, normally you'd just display the content to be printed and the end-user would print it from their browser – Anentropic Oct 19 '15 at 09:41
  • Yes i have created it as web application but it is on local machine only and it has been making for single user on just one machine only. – John Oct 19 '15 at 09:45
  • just use the browser print function then. if you really want to put a 'print' button on the page you can achieve that with javascript, but it's not even needed – Anentropic Oct 19 '15 at 09:48

1 Answers1

0

This should not be a Django matter. It doesn't matter if the web app is on your local machine, a web app is a web app. You have to make clear in your design if you wish to use a printer as a server or as a client.

Since I assume that it is more reasonable to print as the end user, you can simply use a bit of javascript calling window.print() on click.

Wtower
  • 18,848
  • 11
  • 103
  • 80
  • Thanks Wtower, I have tried with javascript calling window.print() , in this case it also printing the address bar information at the right corner of page, is there any method to disable the address bar information while printing? – John Oct 19 '15 at 10:57
  • If you mean the header and footer, you would need to disable them from your browser settings. Otherwise if you mean some header from your web site, you would need to provide css for printing only. – Wtower Oct 19 '15 at 11:12
  • Welcome @John, i am glad it did. – Wtower Oct 19 '15 at 11:25