Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By doWhile

Thread: Open .pdf file inside a jpanel

  1. #1
    pink123 is offline Member
    Join Date
    Feb 2011
    Posts
    84
    Rep Power
    0

    Default Open .pdf file inside a jpanel

    I have a URL of a .pdf file and I want to open this file inside the jpanel or any other swing component.
    Can anyone suggest how can I display the .pdf file inside the jpanel

    Thanks

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: Open .pdf file inside a jpanel

    A 3rd party library like PDFBox will be your best bet.
    Fubarable likes this.

  3. #3
    pink123 is offline Member
    Join Date
    Feb 2011
    Posts
    84
    Rep Power
    0

    Default Re: Open .pdf file inside a jpanel

    Thanks for the reply.Is it feasible to do via java.awt.desktop.
    I found a browse method but it opens in a new window.
    Also I was thinking about JDIC or anything similar to it in Java 6.
    I dont want to use JDIC as no documentation is available online .
    Can you help please

  4. #4
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: Open .pdf file inside a jpanel

    If you want to open in a Swing component, as your requirement above mentioned, then see the above link. If you don't care - in other words the requirement above wasn't actually a requirement - then Desktop.open will open the PDF using the default program to open up PDF's based upon the user's computer, and you should think hard about your requirements before posting.

  5. #5
    pink123 is offline Member
    Join Date
    Feb 2011
    Posts
    84
    Rep Power
    0

    Default Re: Open .pdf file inside a jpanel

    Thanks for the reply.I do want to open the pdf files in a web browser and embedd the web browser in jpanel.
    With Java 5 ,I was using
    org.jdesktop.jdic.browser.Webbrowser webBrowser=new WebBrowser();
    webBrowser.setUrl(testUrl)
    jpanel.add(webbrowser)

    I would like to know if there is any alternative for webbrowser available in Java 6 as I dont want to use JDIC
    I used java.awt.Desktop desktop=Desktop.getInstance
    desktop.browse(testUrl.toURI);

    This open sup the pdf in a new browser.I cannot embedd this in a jpanel
    Please help me out

  6. #6
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: Open .pdf file inside a jpanel

    Seriously - you should have spent a lot more time on your original post. I can only speak for myself, but I do not like trying to respond to posts where the requirements, what was tried, and any other necessary information are not stated outright, and dislike it even more so when they change with every post. I can't read minds (at least, not yet), and neglecting to post all the information wastes all of our time. I am not trying to be rude here, just saying what needs to be said so I can make the most of all of our time (we are unpaid volunteers here) and get you help faster. Now you want a web browser (did you do a web search for how to do this?), anything else you would like to disclose?

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Open .pdf file inside a jpanel

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. An image inside JPanel.
    By Rinas in forum AWT / Swing
    Replies: 4
    Last Post: 10-03-2011, 08:17 PM
  2. Open JPanel with JButton
    By web_dev in forum New To Java
    Replies: 7
    Last Post: 06-13-2011, 11:25 PM
  3. Help making a grid inside of a JPanel
    By satanfx55 in forum AWT / Swing
    Replies: 3
    Last Post: 05-13-2011, 08:18 PM
  4. JPanel inside Jtabbed isn't display
    By Ravanelly in forum Advanced Java
    Replies: 7
    Last Post: 06-08-2010, 11:19 PM
  5. How to add JFrame inside JPanel
    By niteshwar.bhardwaj in forum Java 2D
    Replies: 8
    Last Post: 12-13-2009, 09:41 PM

Posting Permissions

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