With JDIC WebBrowser, how to save the content as an image ?

I wonder if there is a way to save the WebBrowser's content (Html page with graphics) into a *.png image file ? The html page may span several screens, if I do a screen shot, I can only get the top part which I can see, but will miss the off screen contents. What I mean is : if the page is 900(W) x 3500(H) pixels, how to ask my java program to take a screen shot which can get the whole image of the WebBrowser content, including those off the bottom of the screen ?
I was able to do this with the following method for JComponent
  public static BufferedImage Get_JComponent_Image(JComponent J_Component,Rectangle region) throws IOException   // Create a BufferedImage for Swing components. All or part of the component can be captured to an image.
   /* @param J_Component Swing component to create image from
    * @param region The region of the component to be captured to an image
    * @return image the image for the given region
    * @exception IOException if an error occurs during writing
    boolean opaqueValue=J_Component.isOpaque();
    J_Component.setOpaque(true);
    BufferedImage image=new BufferedImage(region==null?J_Component.getWidth():region.width,region==null?J_Component.getHeight():region.height,BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d=image.createGraphics();
    g2d.setClip(region);
    J_Component.paint(g2d);
    g2d.dispose();
    J_Component.setOpaque(opaqueValue);
    return image;
  }So I tried to modify this method to work for Component (since WebBrowser is a sub-class of it), I got black screen with the following modified method :
  public static BufferedImage Get_Component_Image(Component A_Component,Rectangle region) throws IOException   // Create a BufferedImage for Swing components. All or part of the component can be captured to an image.
   /* @param A_Component AWT component to create image from
    * @param region The region of the component to be captured to an image
    * @return image the image for the given region
    * @exception IOException if an error occurs during writing
    boolean opaqueValue=A_Component.isOpaque();
    Out("opaqueValue="+opaqueValue);
//    A_Component.setOpaque(true);
    BufferedImage image=new BufferedImage(region==null?A_Component.getWidth():region.width,region==null?A_Component.getHeight():region.height,BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d=image.createGraphics();
    g2d.setClip(region);
    A_Component.paint(g2d);
    g2d.dispose();
//    A_Component.setOpaque(opaqueValue);
    return image;
  }Can anyone tell me what I did wrong ? Thanks.
Frank

Hi,
Even im looking for the same thing. I tried createImage on the panel but its giving me a blank screenshot, which i presume does not works on the embedded IE area and gives the blank screenshot of the jPanel behind it.
Kindly post any solution you might have come up with.
Thanx

Similar Messages

  • How to save the contents of a file(not a text file)

    Hi all, I want to save the contents of a file(,png file, not a text file) as a field in a class. Shall I have it as a string or byte array or something?
    I have tried saving a file in a string but there were some problems with loading the file from a different platform. Following is my code.
            String string;
            try {
                StringBuffer sb = new StringBuffer(1024);
                char[] characterArray = new char[1024];
                BufferedReader br = new BufferedReader(new FileReader(file));
                while(br.read(characterArray) != -1){
                    sb.append(String.valueOf(characterArray));
                br.close();
                string= sb.toString();
            } catch (IOException ex) {
                ex.printStackTrace();
            }and I use the following code to recover the string back to a stream, and save that stream back to a time later.
        ByteArrayInputStream bais = new ByteArrayInputStream(map.getBytes());I realized that because this file is not a text file, the string could cause some problems. But anyone could tell me if I should use a byte array or someting? and how?
    Any help would be appreciated!
    Cheers,
    Jing

    You should use a byte array, and the binary streams (InputStream a& OutputStream). Never use Strings and Reader/Writer if you have binary data.
    Kaj

  • How to save the content of a JTextArea into a txt file?

    Hi, I want to save the content of a JTextArea into a txt file line by line. Here is part of my code(catch IOException part is omitted):
    String s = textArea.getText();
    File file = new File("file.txt");
    BufferedWriter bw = new BufferedWriter(new FileWriter(file));
    bw.write(s);
    bw.close();
    But I found in the file all is binary code instead of text, any people can help me?
    Thanks in advance

    I can see text in the file now, but the problem is
    when I write three lines in textarea, for example
    111
    222
    333
    then I open the txt file with notepad, it is
    111222333
    How to save them line by line? Use a PrintWriter. It lets you write lines (it's the same class as System.out).
    http://java.sun.com/j2se/1.4/docs/api/java/io/PrintWriter.html

  • How to save the contents of one file into another file?

    Hai,
    i'm trying to save the contents of an existing file into a new file...
    for example.. if i'm having a ms word file namely ss.doc..
    now i want to save itz contents into another file namele dd.doc..
    How shall i do it..
    Can an one plzz explain me...
    senthil.

    Hi, Senthil.
    This Forum is not a general discussion forum.
    You don't believe that the InDesign SDK is a general purpose API. Do you?
    I think you must post issues like this where they belong, in this case in a Microsoft Word Forum.
    Best regards.
    Oscar.

  • My iPhone 5 has broken and is being replaced with a new iPhone tomorrow. However, My carrier (orange) will b picking up my broken iPhone and I am unsure how to secure the content and icloud data on the broken phone. Is there a way to display the data?

    My iPhone 5 has broken and is being replaced with a new iPhone tomorrow. However, My carrier (orange) will b picking up my broken iPhone and I am unsure how to secure the content and icloud data on the broken phone. Is there a way to disable the data held on it and ensure that if it is fixed, nobody can use/see my data and access my account?

    Hi Gazpan,
    Thanks for visiting Apple Support Communities.
    I recommend using the steps in this article to back up your iPhone if possible:
    iOS: Back up and restore your iOS device with iCloud or iTunes
    http://support.apple.com/kb/ht1766
    You may also find this advice helpful for your situation:
    What to do before selling or giving away your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/ht5661
    If you no longer have your iOS device
    If you're using iCloud and Find My iPhone on the device, you can erase the device remotely and remove it from your account by signing in to icloud.com/find, selecting the device, and clicking Erase. When the device has been erased, click Remove from Account.
    If you're unable to complete either of the above steps, you should change your Apple ID password. Changing your password won't remove any personal information that is cached on the device, but it will make sure that the new owner can't delete your information from iCloud.
    Cheers,
    Jeremy

  • How do I save the contents of all of my saved mail folders?

    How do I save the contents of all of my saved mail folders?

    Oh, I see...
    All the mail is stored in ~/Library/Mail (and its associated subdirectories).
    Your Library holder is hidden by default under Mountain Lion (and Lion, too?), so hold the Option key when selecting the Window menu in the Finder to add it to the menu, from where you can access it.

  • How to get the contents associated with a component.

    How to get the contents associated with a component.
    Like i have 2 buttons and i want to get the contents associated with these button without clicking them i.e without firing the event.
    By Contents i mean, whatever things we get after firing the event,we get some other window and some thing is added to the current page and so on.

    grab all the code inside the actionPerformed(ActionEvent e) method

  • When I get messages from Barnes and Noble, the text is blank. If I hit reply or forward, I can then see the content. This only happens with Barnes and Noble. Any suggestions on how to view the content?

    When I get messages from Barnes and Noble, the text is blank. If I hit reply or forward, I can then see the content. This only happens with Barnes and Noble. Any suggestions on how to view the content?

    I'm sorry, but your sister, unless she had already turned on the "Find my iPhone" feature and the person who took the phone has not disabled it, is out of luck. She should report the theft to local police authorities, including the serial number of her iPhone. While her experience is unfortunate, there are good reasons why Apple cannot do anything else about it.
    I hope she gets her phone back.
    Best of luck.

  • How to save the template with cell locking?

    Hi Gurus,
         I have successfully locked the cell by using Data validation of Excel function in BPC input schedule. But when I save and reopen it once again the data validation does not work. My target is to distribute the cell locked template to different users thru offline wizard. Can anybody let me know how to save the data validation in the template ?
    Regards,
    KumarMG

    Resolved myself

  • How to save the bean area content to the database

    DB version:10g
    forms version:10g
    Hi Guys,
    I have used text editor PJC/java bean in my screen where i have attched it to "bean area" field.Iam able to do all the changes to the to the text entered in this "bean area" but when i save this in the database it says no changes to save.in my table the column type is Varchar2.
    any ideas of how to save the changes of a bean area to the database???
    regards

    @François Degrelle -Ya frank i have already checked Get_Custom_Property() but the problem is this is returning the HTML code like
    html>
    <head>
    </head>
    <body>
    This is a <b>styled</b> (<i><u>HTML</u></i>) text<br><b><font color="#0066FF" face="Arial">
    displayed</font></b> and <b><font color="#008000" face="Arial">edited</font></b><br>
    in an <b><font color="#FF0000" face="Arial">Oracle Forms</font></b> application
    </body>
    </html>
    but want the data to be in the formatted so that i can store the data in the column and retrieve formatted text into the text field so that user can see only the formatted text that is lets say
    shdjshdsjdsdsdlas -original text
    shdjshdsjdsdsdlas -formatted text
    now i want to strore shdjshdsjdsdsdlas this text into teh database so that when i retrieve shdjshdsjdsdsdlas this data should be shown.
    regards
    Edited by: user123 on May 27, 2011 4:22 PM

  • How to store the contents of a file

    Hi,
    I'm using forms6i and database 10g.
    Through forms if a user selects a filename , and clicks a button or something,
    the contents of the file should be saved in the database.
    The file can be of any type, like .doc,.pdf,.xml,.html etc...
    and the contents filed will be of type varchar
    Please help me do this..
    Thanks

    Do you really want to save the "Content" of a file or the file itself? If you try to save the contents of a .doc or .pdf in a column with a VARCHAR2 datatype, you are going to corrupt the contents of the file since these file types have binary data in them as well as text. I think you would have greater success storing the actual file in a BLOB column.
    Here are a few Oracle Support documents that discuss how to store and retrieve files stored as BLOBs in the database.
    Doc ID: 168277.1 - How to Upload Binary Documents Back to Database BLOB Column from Forms
    Doc ID: 330146.1 - How to write BLOBs Stored Inside the Database Out to Files.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • How to save the form data into adobe db?

    Hi All,
    How to save the form data into adobe db?
    I have designed one xdp file.
    Through processFormSubmission(), I got the submitted form data as Document obj.
    Then I have called the workflow kickoff program.
    code:
    InvocationRequest request = myFactory.createInvocationRequest ("myprocessname", //Specify the long-lived process name
    "invoke", //Specify the operation name
    params, //Specify input values (HashMap obj)
    false); //Create an asynchronous request
    It successfulyy started the workflow, but the submitted form data is not saved anywhere.
    And also, How get the form data from tables?
    Please provide the solution for the above.
    Thanks in advance.
    Regards,
    Saravanan G

    You need to create a process variable of type IN if you want to be able to pass data to your process. Then the params parameter (HashMap) contains a list of all the IN variables with their content that you want to pass to your process. They key is the name of the variable and the value the content. That way you should get it in your process.
    Now LiveCycle will create a column in the database for every process variable, so the content will be saved in the database just by creating that process variable.
    Jasmin

  • How to save the configuration upon exiting?

    I want to save some results right before my application quit (exit). How?
    Thanks a lot

    I'm not a big fan of serialized data.Any specific reasons for this?Serialization has its good points -- it can be very
    easy to do in Java, for example.
    But my main beef with it is that the data is hard to
    share -- as a specification,
    it locks you into Java. Compare that to designing to
    an XML Schema -- once the Schema is set, separate
    developers can go off and design against that.That makes a lot of sense.
    Can you enlighten me as to how to go about savingthe
    data in XML.I am working on a GUI where the user
    enters info and i thought of using serializationto
    save the contents.But just now you mentioned thetwo
    ways.Please can you enlighen me so that i can tryout
    and see if it's feasible for me to use in myproject.
    If you haven't played around with XML in Java,
    there's a definite learning
    curve, and an alphabet soup of options: SAX, DOM,
    TrAX, StaX.
    The last project I worked on that used a lot of XML
    went with
    XMLBeans: http://xmlbeans.apache.org/
    Once you have a good schema definition, it's easy to
    work with.
    As for Java and XML, perhaps the best thing is to go
    here:
    http://forum.java.sun.com/forum.jspa?forumID=34
    Yes i haven't worked with XML.I was planning to read an online tutorial on it.Thanks for enlightening me JAM.

  • Help on how to read the content of an XML file from the payload

    I have a receiver channel / mail adapter, that sends e-mails with a XML attachment.
    I’m trying to write a Bean, that should make it possible to rename the attached XML file dynamically.
    In the Bean I want to read the content of the attached XML file, it could be the “order number”.
    The filename should then be “Order number”.XML.
    <u><i>Can anyone help me with how to read the content of the XML file from the payload.</i></u>
    <i><b>Frank</b></i>

    hi,
    check this: http://jakarta.apache.org/poi/

  • How to print the contents of a form(window)

    I'm devloping visitors application in java. After the data entry, I need to display the selected information from database along with the photo and take a printout so that it looks like a card.
    I know how to display the contents in a form. How do I print the contents of the form?
    -Thanx
    Hane

    in JComponent there is a method called print(Graphics g)
    you can use that with a Printable class
    read bout the java.print package in the java doc

Maybe you are looking for

  • Error while using BAPI_ALM_ORDER_MAINTAIN

    Dear Experts, Greetings. I am using BAPI_ALM_ORDER_MAINTAIN to change the quantity of the Material Components of a Process Order using BAPI_ALM_ORDER_MAINTAIN. The BAPI returns an error message saying 'Entry Pegged requirement = 12345(Header Material

  • How can I get a cursor position?

    Hi Everyone! In my TextArea, there is a blinking cursor. How can I get the cursor position not the mouse position. Thanks,

  • Splitting and tiling in Illustrator

    i need to find a way to slice an image (jpeg) into 9 or 16 or more equal parts and then convert to PDF so  it can be printerd and that its ends up looking like a large poster.. that can be repasted together...also would be nice if each image spliced

  • Ah, I must be getting advanced - I'm making a mess! - Need advice.

    I'm starting to love to shoot using my Canon 7D and starting to get lots of footage in files that I want to keep as my originals. Since there are often two or three different subjects I want to reference in each file for future use, I would like to k

  • BPC 7.0NW Transportation

    Dear Experts, I need BPC 7.0 NW Transportation User guide. can any body send me the link... Thanks a lot in advance...