Issue opening pdf on mouse click

I have build a swing app which makes search over lucene index and fetches the pdf file from derbydb saves in HDD and let me opens the pdf from the selected row.
public void mouseClicked(MouseEvent e){
            JTable table = (JTable)e.getSource();
            Point p = e.getPoint();               
            int row = table.rowAtPoint(p);
            int col = table.columnAtPoint(p);
            int pkey=dobj.getprimaryKey();    
            openPdf(pkey,(String)lst1.get(row));
public void openPdf(int pkey,String filename)
    DBReadOperations dbr1=new DBReadOperations();
    Connection conn1=dbr1.initalize();
    InputStream ip=null;
    ResultSet rs=dbr1.getPDFStuff(conn1, pkey, filename);
    try {
        while (rs.next()) {
            Blob bl = rs.getBlob(3);
            ip = bl.getBinaryStream();
    } catch (SQLException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    File fr=new File("c:\\savepdffiles");
    fr.mkdir();
    String str1="c:\\savepdffiles\\"+filename;
    System.out.println("entered the openpdf method"+str1);
    try{
    File f=new File(str1);
    InputStream input_Stream= ip;
    OutputStream out=new FileOutputStream(f);
    byte buf[]=new byte[1024];
    int len;
    while((len=input_Stream.read(buf))>0)
    out.write(buf,0,len);
    out.close();
    input_Stream.close();
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+ str1);
   dbr1.closeOperation(conn1);
    }catch (IOException e){
        System.out.println(e.getMessage());
} now when I make my next search and select the another row to open another pdf, all the older pdfs also get open in the order I clicked on the rows.
I want to avoid this, anyone can tell me why the mouse event is going for older pdfs.
Edited by: angelace on Dec 14, 2009 12:22 AM
Edited by: angelace on Dec 14, 2009 12:23 AM

Your code while (rs.next()) {
            Blob bl = rs.getBlob(3);
            ip = bl.getBinaryStream();
        }will set 'ip' to the last entry in the result set and you will open that document. If your DB contains different versions of your file, is the last one the one you want?

Similar Messages

  • FF 6.0 doesn't open pdf-links, after clicking on "open pdf" error message says file not supported or damaged. IE opens file all right. Please advice.

    Firefox 6.0 doesn't open pdf-links after clicking on "open pdf". I frequently need to do literature searches and I need to view pdf files in the browser. After clicking on the pdf - link of a file the main options are to open or download the pdf. Every time I try to open a pdf-file a blank page and an error message appears saying the file would not be supported or is damaged. IE, however, opens the file all right. I tried various changes in the security and cookie settings without success. Please advice.

    Hi SGckc,
    This document is almost certainly a dynamic XFA form. Unfortunately, our mobile Reader does not support displaying or filling such forms. The application that produces this form embeds this message into the document so that non-supportive viewers (like ours) will display this "error" page when the document opens. I do realize that this is confusing and I would like to add some additional detection to our Reader for this case. However, we've avoided doing this for fear of confusing users even further. Your feedback helps though. Hopefully we'll find a way to detect this case and present a better message to the user like: This form is not supported by the mobile version of the Adobe Reader. Please open and fill it on the non-mobile version of the Adobe Reader for Windows, Linux or Mac OSX.
    Thank you for contacting us!
    Pat

  • I have been able to open pdfs created in older versions of adobe, but not the newest version. Is anyone having issues opening PDFs sent via email created in version 9?

    I have been able to open pdfs created in older versions of adobe, but not the newest version. Is anyone having issues opening PDFs sent via email created in version 9? If so, what was your solution? I have PDF reader app as well.

    Can you open the files in Preview?

  • Two JDialogs are getting open on single mouse click in MAC

    Hi ;
    I have a button,which opens a Jdialog on single mouse click,but if i do clicking multiple times,then multiple Jdialog are getting opened this issue is occuring in MAC only and not in windows.I have used all the methods of mouse event listener but there is no impact seen all,please give me some idea on this...

    To get better help sooner, post a SSCCE that clearly demonstrates your problem.
    Use code tags to post codes -- [code]CODE[/code] will display asCODEOr click the CODE button and paste your code between the {code} tags that appear.
    db

  • Issue opening pdf's in IE8 XP

    Hello,
    I'm having trouble opening pdf's through an internet sharepoint. When left clicking them the page either refreshes or gives the error "Internet Explorer has stopped trying to restore this website. It appears that the website continues to have a problem."
    I can open the files by right click -> open in new window/tab, copying the file location and entering in the search bar, saving to my pc and opening. Any method works besides simply left clicking!
    Any ideas would be appreciated
    Lewis

    I know what you mean but the only thing is left for you is to backup and the reset you iPad to see if the issue is present after that or not. When your iOS is normally installed it could only be the app that's not working without problems. Or maybe wait for the next iBooks update and see if it fixes the bug with the .pdf's. At least you now have an app with that you can read them.

  • Open PDF report on clicking a URL link

    Hello,
    I have a requirement to open a PDF report when clicking on a URL.
    Example : Open a Purchase Order PDF report when clicked on a URL from a different web based system (non APEX). I was able to open APEX pages from the web pages but i am not sure how to open a PDF report. I will have to pass PO number in the URL.
    I would really appreciate it If anyone can give me some direction. I have created PDF reports within APEX and called from within other Pages in APEX but not outside of APEX.

    Sorry I really didn't mean to be stupid ;)
    below is my requirement. We use oracle ebs and we use forms version. Our requirement is to open various PDF reports by clicking a buttons/menu in different forms with in Oracle apps forms. We have APEX developer who can create PDF reports in APEX easily but the technology on ebs side is complex to develop simple PDF in the way users want. So we were thinking if we create a PDF report in APEX..and call the apex report from ebs. Is this possible? Inow we can call other APEX web pages from EBS.

  • Issues Opening PDFs with Reader 10.1.5

    Since upgrade to Adobe Reader 10.1.5 our users have had problems opening PDF files. Most times it takes at least 5-6 attempts at trying to open the file and sometimes it just never opens. It doesn't matter if the PDF is in an email, local, on the network or on the Internet.
    For now, I have put them back on 10.1.4 with no issues. Any ideas if this is a known issue with 10.1.5 and if there will be a patch released soon?
    Windows 7
    Thanks!

    I am having a similar problem and was wondering if there is an update yet. I am running Windows 7 and Acrobat 9 Pro. I can open local PDFs in Acrobat. If I am in IE links for PDFs open in Acrobat, however, in Chrome PDFs don't open and I usually, eventually get this message:
    Also, when I tried to open Reader, I got a few messages that went by quickly that couldn't capture, but one said something like "looking for updates." Then nothing opened. However, when I opened Task Manager, I saw several processes for AcroRd32.exe *32.
    This has been going on for a couple of weeks and previously I have rebooted and this has sometimes fixed the problem. But this doesn't seem to work anymore. A couple of days ago I rebooted and was able to open Reader and run repair. It appear to fix the problem, but now it's back again and this time I am not even able to open Reader to run repair again.
    If there is no response in the short term, I will uninstall and reinstall to see if it corrects. If that doesn't work I will see if I can install an earlier version.

  • I am having issues opening PDF files in safari, I am running OSX 10.5.6

    When I attempt to open any PDf files it will either go to choose viewer to open this type file? (None available in selections?) Or just goes to a black screen where you can only cancel to get out of it.
    I was told that OSX automatically opens PDFs in Safari etc. If I right click the file / link and save linked files to download then I can open them. Is there anyway to have safari open them with the proper app automatically?
    Thank you for all replies.
    Dan

    OK, now we're on the same page. I didn't realize it but I can't open pdfs either. I'm on a brand, new iMac and pdfs don't work for me anymore. It also doesn't work in Firefox. I'll need to do some checking for both of us.
    What does work is when the cog wheel stops rotating you can save the pdf via the File->Save As menu in Safari.
    Message was edited by: Old Toad

  • Issue opening pdf's in ibook app

    Updated IPAD2 to IOS 5.0.Now having issues with opening PDF's from external apllications in ibooks. The pdf files which are already in ibooks works fine and the pdf it self i can read in other applications too on ipad when i try to import the  pdf in to ibooks by selecting open in ibooks nothing is happening.
    What is going on any help will be appreciated.

    I know what you mean but the only thing is left for you is to backup and the reset you iPad to see if the issue is present after that or not. When your iOS is normally installed it could only be the app that's not working without problems. Or maybe wait for the next iBooks update and see if it fixes the bug with the .pdf's. At least you now have an app with that you can read them.

  • Issues with "wait until mouse click"

    when I put wait until mouse click it doesn't register mouse down or mouse up. Because of that, my game is sloppy and skips some scenes if I accidentally hold down my mouse for more than a split-second click. Is there any way to manipulate the wait for mouse click behavior so it works only when the mouse button is released?

    Hmm, I wonder if he figured it out already, since he didn't even answer your question.  He seems to be talking about the built-in "Wait for Mouse Click or Key Press" behavior in the behavior library.  Sometimes those behaviors can become overly complicated for the simplest of things.  I recommend you just go ahead and roll your own frame script, as EtchK was implying.  It's pretty easy, you just need two short handlers:
    on exitFrame
      go to the frame
    end
    on mouseUp
    -- do whatever
    end

  • Issues opening PDF files from SharePoint document library reader/pro 11.0.5

    Hello,
    We have a sharepoint 2010 enviroment and recently upgraded our Acrobat X11 installs ( both reader/std/pro) to version 11.0.5.
    We have a mixture of WIndows 7 32/64Bit IE 8 and IE 9 machines
    After upgrading to 11.0.5 when users click a pdf file in a SP document libary one of two things happens depending if they have the
    Adobe Reader Plugin Enabled or not
    If the Adobe Reader Plugin is enabled, they will not get prompted to run/save the pdf file and it will not open in a new tab in the browser
    If the Adobe Reader Plugin is disabled, they will get a popup window that has the correct URL to the PDF in the address bar but they will not be prompted to save or run the file.
    If they click in the addrss bar and press enter the pdf will then load in the external reader/acrobat application.
    This issue started with 11.0.5 updates, rolling people back to 11.0.4 fixes the issue.
    I have attempted everything I can think of including rebuilding new machines with our image.
    Has anyone see issues like this with the 11.0.5 update?

    If a bug is confirmed, a fix may be delivered in the next release (can't promise). For a similar issue caused by a Microsoft bug, see http://forums.adobe.com/message/6106294#6106294.
    Ben

  • Issues opening pdf in a modal jdialog

    Hi guys,
    I've a strange issue, I can't solve it.
    I'm newbie of java swing and this is a very difficult issue.
    I've a jdialog modal. In this jDialog I've a button, clicking on it a pdf is generated with itext.
    I observed that:
    -if I try to generate pdf from a frame, pdf is shown over the frame.
    -if I try to generate pdf from a jdialog swing(that's case I need) pdf is shown below jdialog...so I can't see pdf without closing jdialog and it's not good.
    How can I proceed in the second case?
    Thanks

    hi,
    thanks for your reply...I try to addo more detail.
    I have a modal jdialog.
    In it I have a button, clicking on it is called a method to create a pdf with itext.
    Here a snippet of code
    try {
                  Document document = new Document(PageSize.A4);
                   PdfWriter.getInstance(document, new FileOutputStream(FILE));
                   document.open();
                            create(document);
                   document.close();
                            String[] command = new String[3];
                   command [0] = "cmd.exe";
                   command [1] = "/C";
                   command [2] = "\"" + FILE+ "\"";
                            Runtime.getRuntime().exec(command );
              } catch (Exception e) {
                   e.printStackTrace();
                            JOptionPane.showMessageDialog(null, "Si è verificato il seguente errore: "+e.getMessage(), "Errore stampa pdf", JOptionPane.ERROR);
                            return;
              }Following this way pdf is opened but it's shown under the modal jdialog that called it.
    So for watching it I need to close modal jdialog.
    How can I run pdf to make it OVER a modal jdialog?
    Thanks,
    Regards

  • Acrobat 7.0.9 and Reader 9 - Issues opening PDF in IE6

    I'm hoping someone can help.  All our users have Reader 9 installed as part of the corporate image.  Some of our users run Acrobat 7.0.9 as well.  For those users, we are experiencing issues where when we try to open a PDF in IE6.  We get the following error:
         SW:iexplore.exe_application error - The instruction at "0x052f51b6" referenced memory at "0x00000010".  The memory could not be "read".
    I've opened Acrobat 7.0.9 and checked Edit, Preference, Internet.  The option to untick "Display PDF in browser" is greyed out.
    I've opened IE6 and gone to Tools, Manage Add-Ons and there is nothing listed for "Acrobat Control for ActiveX (pdf.ocx)" listed.
    I've tried uninstalling Acrobat and reinstalling.  I've then also tried running a repair on both Reader and Acrobat, but nothing seem to be fixing the issue.  This has only started happening since we upgraded Reader to 9 in our image.
    Any advice on how to fix the issue would be greatly appreciated.

    From: <[email protected]><br /><br />| Adobe STRONGLY recommends that you DO NOT not have Acrobat and Reader installed on the<br />| same system. If you have just Acrobat installed, it will perform all the functions<br />| Reader does and much more. Therefore, you should uninstall Reader, install Acrobat, and<br />| DO NOT install Reader again.<br /><br />| Ken F.<br /><br />Not to mention that nobody should be using Adobe Reader v7.x do to all the vulnerabilities <br />in it that are *actively* being exploited !<br /><br />-- <br />Dave

  • Issues opening pdf's

    i am in advertising and we have a website that we get our proofs from in a pdf format. With previous versions of reader, I have had no problems opening, saving, printing etc many times over in a session.
    But now I can one or two then I start getting a message that pops up that says:
    There is a problem with Adobe Acrobat/Reader.
    If it is running, please exit and try again. (523:523)
    I exit and it does not fix it. I have to reboot the machine before it will open or save any more pdfs.
    Please advise,
    I am on a windows 7 machine using internet explorer (newest version)

    Please let me know the following:
    1. The version of Adobe Reader installed on your machine (you can get the same by clicking on Help > About Adobe Reader)
    2. If you have Adobe Acrobat installed on your machine as well.
    Also, can you please try and remove the folder C:\Program Files\Common Files\Adobe\Acrobat\ActiveX and then repair the application via Control Panel.

  • New tabs will not open (ctrl-T, mouse click or menu)

    For some reason I cannot open a new tab unless I right click on a hyperlink on the existing tab and select "open in new tab". When I click "File/New Tab" nothing happens. When I click the plus sign on the tab list nothing happens. When I press Ctrl T nothing happens.
    By the way, IE has the same problem and started at the same time.

    Try uninstalling the Ask toolbar and it should work again. There is a compatibility issue with the Ask toolbar and the current version of Firefox.

Maybe you are looking for