Printing from a applet toolbar the image displayed in the applet

Hi ,
I have a JApplet which displays a tiff image. The applet uses JAI API and Java 2D for printing. I can zoom in . zoom out , invert the image and I am printing the displayed image also .
In the action handler class for the print button , I have made an inner class implementing printable and executing the print function.
I am doing printing via a separate thread as i don't want my action handler class to keep waiting till the image gets printed . The user should be able to manipulate the image after it has clicked on the "ok" of the print dialog, while the image is being printed. This is the reason for printing the image in a separate thread
and the actual printing process is a synchronized method called by the run method of the thread .
If I click on print button twice , one after another , the second image gets printed only after I get a response from the printer that image has been printed as expected (as the print method is synchronized ).
In the action handler class of print , I do not call join on the thread as I do not want it to wait for printing to get over ( printing of a tiff image actually takes a long time ?? )
Is there anyway to make the threads independent of the main applet . Like after firing the print command , if I close the applet and I haven't got a confirmation from the printer, I get a blank page or nothing but i get a response message from printer that printing is done .
Is it essential for a thread to wait till the printer sends a response that printing is over ?
Similarly , If after firing the printing command and without waiting for the confirmation from the printer , I refresh the applet , proper printing does not occur but I get a message from the printer that printing is done .
If i use synchronized method for printing and wait till the printer response from the printer comes without closing or refreshing the applet , printing occurs fine .
Can anyone please tell me what is actually happening and is there a better way to print and that printing occurs after the print command has been fired irrespective of the applet ?
Regards , Navneet

Hey can you send me the code for the same. I know its been a long while, but I am new to JAI and need the same stuff u coded. u can mail it to me on [email protected]
Thanks in advance.

Similar Messages

  • Anyone know of a way to adjust the top and side MARGINS of a document printed from iOS numbers? The default margins are too wide. Need more working space.

    Anyone know of a way to adjust the top and side MARGINS of a document printed from iOS numbers? The default margins are too wide. Need more working space.

    Open the document,
    Tap the Tools icon (upper right).
    Tap Document Set up.
    Drag the margins to the position you wish (the actual margin width sould display as you are doing this).

  • Printing from trusted applet

    Hey boys and girls.
    I need a litle help. Does someone has expirience with printing on local raw printer from browser? I think that is possible, but since I am new with Java and some time to learn it good, I will relly on your help. It would be a super if your have a piece of code. Again, we are talking about raw dot-matrix printers and they will be used for printing data for documents like passport, personal ID's driver licence. You know, the old style... Thanks

    Hi Milind
    I never had security exception for printing from an Applet even if applet jar is not a signed jar and security policy file is not altered.

  • HT4356 How can I print from my iPad in the app Pinterest

    How can I print from my IPad in the app Pinterest.  I cannot find a way to do it!

    I think she/he meant me.
    If the app won't let you print directly from it you might want to open in safari or make a screen capture then print from your photos.

  • Why cant i print from my ipad using airport express but i can print from my mac using the express

    why cant i print from my ipad using airport express but i can print from my mac using the express

    Because your printer has to be Airprint compatible and connected to WiFi. There are applications, such as Printopia, that will allow you to print through your computer.

  • HT4356 I checked everything out and had no problem printing from IPAD/MINI using the HP Photosmart 6520 printer, but the next day, using same application, my HP did not show, but was looking for the AirPrint Printer, what am I doing wrong?

    Using IPAD2, IPAD MINi, HP photosmartE6520 set up on wireless network.  No problem printing from my devices, but the following day, it is looking for AirPrint printer, why? 

    Hello lenc48,
    Welcome to the HP Forums.
    I see that you are having a few issues when it comes to printing from your mac as well as some two sided printing issues.
    I do have a some suggestions that we can try in the attempt to troubleshoot this issue.
    First off, please make sure that you have the printer power cable connected directly to a wall outlet and not a power bar/strip. Here is a document that uses a LaserJet printer as an example but it is meant for HP products in general. Please click on the following link that explains the Issues when Connected to an Uninterruptible Power Supply/Power Strip/Surge Protector.
    Please remove the usb cable (if using wireless, disregard this step) from the printer and from the Mac and leave it disconnected until further notice.
    Please click on the first link that will give you instructions on Uninstalling the Printer Software.
    Once the software has been removed, please disable any anti virus protection that you may have on the Mac. 
    The next step we are going to take is downloading the HP Photosmart 6520 e-All-in-One Printer Full Feature Software and Drivers - OS X 10.9 Mavericks.
    The installation will prompt you when to connect the usb cable (You will see a prompt for a wireless connection as well if that is the connection type you would like to use) so please do not connect the cable until prompted to do so.
    If you are still having issues, feel free to write me back or you can contact HP Total care direct.  If you are calling within North America, the number is 1-800-474-6836 and for all other regions, click here: click here.
    Thanks for your time.
    Cheers, 
    Click the “Kudos Thumbs Up" at the bottom of this post to say “Thanks” for helping!
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    W a t e r b o y 71
    I work on behalf of HP

  • HT4356 I have an older HP connected to the usb port of my Time Machine, and have it shared.  I want to print from my iPhone on the network, but it can not be found in airport?  How do I make this work?

    I have an older HP connected to the usb port of my Time Machine, and have it shared.  I want to print from my iPhone on the network, but it can not be found in airport?  How do I make this work?

    AirPrint printers connected to the USB port of the Apple AirPort Base Station or Time Capsules are not supported with AirPrint.
    Read through this for information about Airprint printers and how to use them:
    http://support.apple.com/kb/ht4356

  • When printing from an online PDF, the page prints in extra large scale. How do I fix this?

    when printing from an online PDF, the page prints in extra large scale. How do I fix this?

    This can happen when Firefox has misread the paper size from the information supplied by Windows. Clearing it can involve finding some obscure settings, but here goes:
    (1) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
    (2) In the search box above the list, type or paste '''print''' and pause while the list is filtered
    (3) For each setting for the problem printer, right-click and Reset it. The fastest way is to right-click with the mouse and then press the r key on the keyboard with your other hand.
    Note: In a couple other threads involving Brother printers, the preference '''printer_printer_name.print_paper_data''' was set to 256 and when the user edited it to 1 that fixed the paper size problem. If you see a 256 there, you can edit the value by doubling-clicking it or using right-click>Modify.

  • How to print from my itouch to the printer

    how to print from my itouch to the printer

    Hi there, AirPrint is the solution you maybe looking for! Please visit the following page on hp.com to get some more details and instructions for AirPrint and also the current list of supported products here: http://www.hp.com/sbso/printing/mac/apple-airprint.pdf?jumpid=reg_R1002_USEN and apps here: http://www.hp.com/sbso/printing/mac/list-airprint-compatible-apps.pdf?jumpid=reg_R1002_USEN
    I am an HP employee.
    Feel free to provide Kudos if I have helped you!

  • I have a hp m175nw printer. the email prints from my iphone, but the picture does not

    m175nw printer. the email prints from my iphone, but the picture does not
    This question was solved.
    View Solution.

    If the DPI(dots per inch) is under 100, the printer will not print the picture because it would be too low in quality. Pull the picture up on the computer, right click on it and click on properties, Check out the horizontal and vertical DPI and see if both of those numbers are least 100. Have you tried to connect the iPhone to the same network as the printer and try to AirPrint the pic? The AirPrint route does not have the same DPI requirements as the ePrint .
    I am a former employee of HP...
    How do I give Kudos?| How do I mark a post as Solved?

  • How can I print from my ipad to the plain paper tray not the photo tray?

    I have a new 
    HP Photosmart Plus All-in-One Printer - B209a
    and an ipad on my showroom floor.
    I let my customers use the ipad to browse through photos of items that are not on display, then print some of the photos. Right now the print job always goes to the photo tray - but I want it to print on plain letter size paper.  If there is no photo paper in the tray, the print job fails with an out of paper error.
    Is there a way to get this printer to print photos from the ipad photos app onto the standard paper tray?
    Thanks in advance for any insight you can give me.
    Richard

    Photos will always print from the photo tray, if the printer has one. This cannot be configured by the user currently.
    (Although I am an HP employee, I am speaking for myself and not for HP)

  • Printing from an applet on a Mac

    Printing from an unsigned applet is allowed by the java plug-in. When a print request is made it pops up a confirmation dialog after which the print job goes through on Windows. On a Mac, however, a security exception is thrown after the confirmation dialog:
    java.security.AccessControlException: access denied (java.net.SocketPermission localhost:631 connect,resolve)
    The entire stack trace is copied at the end.
    It appears that the applet is trying to open a connection to port 631 on localhost (Port 631 is the standard port for the IPP protocol). Usually an applet is only allowed to open a connection to the host that it came from (not localhost in this case). Therefore, the exception seems reasonable. However, when the print request is sent a second time the print job goes through! I don�t know why!
    Has anyone encountered this problem on a Mac (OS 10.4.7; Java version 1.5.0_06) ? Is there a solution? It works just fine on Windows!
    Thank you!
    java.security.AccessControlException: access denied (java.net.SocketPermission localhost:631 connect,resolve)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
         at java.security.AccessController.checkPermission(AccessController.java:427)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
         at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
         at sun.net.www.http.HttpClient.openServer(HttpClient.java:459)
         at sun.net.www.http.HttpClient.<init>(HttpClient.java:214)
         at sun.net.www.http.HttpClient.New(HttpClient.java:287)
         at sun.net.www.http.HttpClient.New(HttpClient.java:299)
         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:792)
         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:744)
         at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:669)
         at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:836)
         at sun.print.IPPPrintService.opGetAttributes(IPPPrintService.java:1419)
         at sun.print.IPPPrintService.initAttributes(IPPPrintService.java:323)
         at sun.print.IPPPrintService.getSupportedDocFlavors(IPPPrintService.java:697)
         at sun.print.IPPPrintService.isDocFlavorSupported(IPPPrintService.java:773)
         at sun.print.RasterPrinterJob.getPrintService(RasterPrinterJob.java:431)
         at sun.print.RasterPrinterJob.setAttributes(RasterPrinterJob.java:1002)
         at apple.awt.CPrinterJob.setAttributes(CPrinterJob.java:130)
         at apple.awt.CPrinterJob.print(CPrinterJob.java:173)
         at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1200)
         at PrintTest.printApplet(PrintTest.java:47)
         at PrintTest$1.actionPerformed(PrintTest.java:25)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
         at java.awt.Component.processMouseEvent(Component.java:5554)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5319)
         at java.awt.Container.processEvent(Container.java:2010)
         at java.awt.Component.dispatchEventImpl(Component.java:4021)
         at java.awt.Container.dispatchEventImpl(Container.java:2068)
         at java.awt.Component.dispatchEvent(Component.java:3869)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
         at java.awt.Container.dispatchEventImpl(Container.java:2054)
         at java.awt.Component.dispatchEvent(Component.java:3869)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

    Yes!!  This is VERY HARD to find.  I literally spent ONE YEAR looking for solutions to my printing problems until I found this little drop-down box in the middle of the second or third dialog box that the Mac OS offers you when you're printing.  If you're still not finding it, ask us again.  I'm not in front of my Mac right now, and I'll be glad to give you detailed instructions.  I tried several hundred different things before I could get my photos to print well, and the secret was always right there, hidden in that tiny drop-down menu in the center of that dialog box.  VERY frustrating.

  • Printing from lightroom leaves lines on image

    Hi All,
    I'm using a late 2009 iMac running Lightroom 5.5 and printing to a canon MG7150 photo printer.  When i try to print photographs (I'm using Ilford photo paper but the same result happens with normal paper) i get lines across the printed page.  I've played around with the printer set up (head alignment etc) and have even had a replacement printer but am still getting the same issue.  I printed the same image from photoshop and the lines were still there but at a much wider interval so I guess it must be something to do with the print settings or the way that lightroom interacts with the printer?  See below for an example scan of one of my shots, the lines can be clearly seen
    I'm printing using The Ilford printer profile specifically for the MG 6150 (they dont seem to do one for the 7150) but i get the same results whether I print using the profile managed by printer / lightroom.
    please help this is driving me a bit nutso!
    Thanks

    I don't believe this has anything to do with Lightroom. When you go to page setup, can you choose quality, and then choose photo? It looks to me like the printer is trying to print in standard text mode. Also, I wouldn't suggest using a profile that seems to be close to what you have for a printer. If the profile isn't for your specific printer I would suggest not using it.
    Incidentally, I checked with Red River paper company and they provide profiles for their paper for the Canon MG7120, but not for your printer model. I'm not familiar with the Canon MG printers, so I don't know if your model uses the same print head technology as the 7120. If the print head is different then I would assume that your printer model doesn't really support printer profiles, but that is only a guess.

  • Provider !DOCTYPE ... error while printing from an applet

    Hi,
    I'm developing a (signed) applet that requires access to the local printer. The applet will parse an XML document using [Flying Saucer|http://xhtmlrenderer.dev.java.net/] . I'm developing it in Eclipse.
    When I run the applet from Eclipse, everything works fine, and a print is produced by the printer. I then export the applet as a jar file, sign it, and put it on a local server. When I run the applet in any browser (whether its IE or Firefox) the thing crashes with this error:
    Exception in thread "AWT-EventQueue-2" javax.xml.parsers.FactoryConfigurationError: Provider <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> not foundThis exception seems mangled to me - shouldn't it produce a classname as opposed to the DOCTYPE declaration String?
    I've signed all the jars required (Flying Saucer's core-renderer.jar & jtidy.jar), accepted them in the browser. All dependencies should therefore be resolved.
    To be sure: I am NOT referencing the DOCTYPE anywhere in the Java code, nor in the HTML source document, nor in the HTML document hosting the applet. In short, I cannot find any trace of the DOCTYPE given in my source code. Where does it come from?
    Here's a stack trace. Hopefully someone has a great tip! :)
    Reading certificates from 2718 http://w2668.gerben.mylocalserver/overig/awtprinting/AwtPrinting.jar | C:\Users\jeroen\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\63\7843b8ff-292dbe4c.idx
    Reading certificates from 10062 http://w2668.gerben.mylocalserver/overig/awtprinting/jtidy.jar | C:\Users\jeroen\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\20\1e6e98d4-7d7b6963.idx
    line 1 column 110 - Warning: inserting missing 'title' element
    Reading certificates from 76688 http://w2668.gerben.mylocalserver/overig/awtprinting/core-renderer.jar | C:\Users\jeroen\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\33\62996421-47904dc4.idx
    Reading certificates from 53283 http://w2668.gerben.mylocalserver/overig/awtprinting/iText.jar | C:\Users\jeroen\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\4\1a988704-442d6437.idx
    Exception in thread "AWT-EventQueue-2" javax.xml.parsers.FactoryConfigurationError: Provider <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> not found
                    at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source)
                    at org.xhtmlrenderer.resource.XMLResource.newXMLReader(XMLResource.java:145)
                    at org.xhtmlrenderer.resource.XMLResource$XMLResourceBuilder.createXMLResource(XMLResource.java:170)
                    at org.xhtmlrenderer.resource.XMLResource.load(XMLResource.java:75)
                    at org.xhtmlrenderer.pdf.ITextRenderer.setDocumentFromString(ITextRenderer.java:157)
                    at com.mycompanyname.printing.Printable.print(Printable.java:193)
                    at com.mycompanyname.printing.ClientPrinterApplet.print(ClientPrinterApplet.java:350)
                    at com.mycompanyname.printing.ClientPrinterApplet.paint(ClientPrinterApplet.java:145)
                    at sun.awt.RepaintArea.paintComponent(Unknown Source)
                    at sun.awt.RepaintArea.paint(Unknown Source)
                    at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
                    at java.awt.Component.dispatchEventImpl(Unknown Source)
                    at java.awt.Container.dispatchEventImpl(Unknown Source)
                    at java.awt.Component.dispatchEvent(Unknown Source)
                    at java.awt.EventQueue.dispatchEvent(Unknown Source)
                    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
                    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
                    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
                    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
                    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
                    at java.awt.EventDispatchThread.run(Unknown Source)

    The problem was with the entity resolver, which points to the w3c.org web site. The access to the reference DTDs on this site has been restricted for application use. The solution was to implement my own entity resolver.

  • Using applescript to print from printers other than the default

    Hi
    I have this script to print from Quark which works fine:
    tell application "QuarkXPress"
    tell print setup of document 1
    set separation to false
    set printer type to "HP Laserjet 8150 Series"
    set paper size to "A3"
    set orientation to portrait
    set bleed to "3"
    set page position to center horizontal
    set print spreads to false
    set reduce or enlarge to "100%"
    set registration marks to centered
    set tiling to off
    end tell
    print document 1
    end tell
    It works fine but if I change my default printer to something else eg. our canon colour printer, then the document prints from there instead.
    If anyone can help it would be much appreciated
    Kind Regards
    Andrew

    Thanx Nova Scotian..
    Didnt quite work but i got this from another forum which did in case your interested:
    tell application "Printer Setup Utility"
    set the visible of every window to false
    if printer "ExactPrinterName" exists then set current printer to printer "ExactPrinterName"
    get current printer -- debugging
    if (current printer is not "ExactPrinterName") then display dialog "Please setup your 'ExactPrinterName'!!"
    quit
    end tell
    Of course, ExactPrinterName is the name of the printer you WANT to use as it exists in the Printer Setup list.
    Andrew

Maybe you are looking for

  • Consolidation Error

    Gurus, How to handle this issue - I'm getting this error. Check the clearing item for interunit posting Message no. G00323 Diagnosis Check the settings for clearing item  for postings across consolidation units with regard to the cons chart-based att

  • Error in Creating Source System

    Hi, I have a freshly installed BW System here .... I noticed when I tried to create a new source system .... There is a message " No entry for BW_USER in the RSADMIN available" Please assist Thx

  • F4 for variable on 0FISCPER takes too long

    Hi , I have a multiprovider on an ODS( DSO) on which I am creating my query. One of the characteristic is 0FISCPER on which I have created a varibale. The setting of the infoobject is as follows. In the advance tab of the infoobject 0FISCPER in the q

  • Error when send file by RMI

    I take application RMI client, server. Client will auto print screen by 3 seconds, when send to server. Server delete picture old and update picture new. But client only send a first time, next time is throw Exception "java.io.IOException: Write erro

  • ActiveX and PlugIn Flashplayer both installed - only ActiveX updates automatically

    I'm responsible for a bunch of Windows computers including some at a non-profit where we have both IE and Firefox (as well as Chrome) installed. Consequentially we have both the ActiveX and PlugIn versions of Flashplayer installed.  It seems that the