-
May 31st, 2012, 04:58 AM
#1
Printing got Shuffled
Dear Sir/Madam,
I have a doubt in applet printing.
I have written a applet code which will sent epson code directly to printer.
I am calling this applet APT through javascript.When such 10 APTs called consecutively, after it goes to printer the order gets shuffled.Am giving flusg command inside the applet code. The applet call is made in a loop. So the for e.g if we want to print 10 things, it will be passed one by one.
Can any one pls help me to solve this issue.
-
May 31st, 2012, 04:16 PM
#2
Re: Printing got Shuffled
Sounds like a threading problem but as I've no idea what you are doing it's hard to say.
If you've one instance of the applet then consider using a Queue from the java.util.concurrent package between the javascript calls and the rpinting sub system. The javascript calls (producer) add the data to the queue and return. Your applet has a background thread (consumer) which loops around calling the queue's take() method which blocks the thread until there is data to return. When it does return with the next data element this consumer thread prints the data and finally loops around to call take() again to get or wait for the next data.
Because the queue is a FIFO queue the print output is guaranteed to be in the order the data was added to the queue.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|