• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

counting number of invoice printing

Hi all,

Is it possible to know how many time that one invoice is printed? I want to trace whether a invoice is printed or not? Can javascript interact with printer?

1 Solution
The only thing you can do with JS concerning printing is to launch (through window.print) a request for printing - that is open the print window where the user must confirm the print.
You can't even check if the user said OK in this window, neither auto launch the print task without prompting.

Hope this help ;)
Ian GoughCommented:
<form><input type="button" value=" Print this page "
onclick="window.print();return false;" /></form>
<a href="#" onclick="window.print();return false;">print</a>

And i'd prob use database counter system so everytime the button was pressed it added 1 to the database. (Using the <form> not the onclick)
Just an Idea,
Ian GoughCommented:
Ok i can't seem to fine any where that .js can write a log file so you prob have to use php counter system and you just need to change the button to an image and get a click counter then it will write a log file in php.
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

sdiekenAuthor Commented:
I did as the first iangough7 comment but I meet a problem as smaccari comment. I can't even check if the user said OK in this window :( What I want is to count a real printed invoice.
As i told you, you simply cannot do this in JS ;)
Jens FiedererTest Developer/ValidatorCommented:
You should listen to smaccari.

When you are doing js, you are helping to provide some content.  You simply DO NOT GET TO CONTROL the user's machine.

If what you need to "control" your user, your option is to run some application object (Java or ActiveX, for example), make the invoice information ONLY available to that object...and display (since anything you display normally can be captured in a screenshot and printed outside of your control) and print ONLY from that object.  This is not really JS.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now