开发者

JSF/Applet - How to call a function (auto increment a number) every time a page prints

Hello guys i'm creating a web based label (barcode) printing application in Java (JSF) that requires printing via web.

A certain scenario was given during our testing: If the user wants to print 10 copies of the same label (barcode), a field in the label which called the se开发者_开发技巧rial number must increment itself. Let say for example the last number generated was 100, then each label must have a unique serial number - 101, 102 ... 110.

I'm thinking of a way to call a function each time a printer prints a label or if there are any other ways to achieve this functionality.

Your help will be much appreciated and I'd like to thank you in advance for your response.


From your browser : propose a print button, which fill update (javascript) the page before opening the print dialog (JS : window.print). You can also have a look at onAfterPrint (http://www.webmasterworld.com/javascript/3038993.htm, IE only) to intercept in javascript the print action.

Other possible design (better) is to handle this on the server. This is the only way if you want that the concurrent users will not use the same serial numbers. --> propose a button that gets a PDF generated by your server with the proper serial number. The pdf is then easily printed cleint side.

Of course, you will never be sure the pdf is actually printed. But having the printers theselves reporting directly to the server seems very complex to organize.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜