CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012
    Posts
    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.

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    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 code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured