This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes Java Image Capture, Buffered Image, Paste in MSWord 2007 problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Java Image Capture, Buffered Image, Paste in MSWord 2007 problem" Watch "Java Image Capture, Buffered Image, Paste in MSWord 2007 problem" New topic
Author

Java Image Capture, Buffered Image, Paste in MSWord 2007 problem

Tarun Bolla
Ranch Hand

Joined: Jun 20, 2011
Posts: 89
Hi,
I have asked a related question before...but there was no reply. I dont know how to revoke it (may get an answer this time).. so i thought i would ask again..

I am changing the problem statement a bit.
Consider the following code for capturing a part of the screen

Now after running the code, a small part of screen will be captured to clipboard. Paste the same content in mspaint, msword 2007. Paint renders it correctly. Word blurs it. Why is it so and how can i correct it? Thanks in advance folks....
My prev ques link : http://www.coderanch.com/t/542443/GUI/java/Manipulating-BufferedImage-dpi-related
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
run your program, paste into word.
now right-click the image and select 'Edit Picture'

without doing anything else, the image 'sharpens' to that of 'paint' i.e. what you want.

strange, so it is likely to be something to do with word 2007.
Tarun Bolla
Ranch Hand

Joined: Jun 20, 2011
Posts: 89
Yes Michael, you are right! Thank you!
So do we have any specifications on how the image data in clipboard should be before pasting in word??
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> So do we have any specifications on how the image data in clipboard should be before pasting in word??

I think it's more to do with how it's pasted - instead of paste, try 'paste special' and select the default png or bitmap,
they all seem to work OK.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4530
    
    5

Word has some settings related to image compression. Maybe changing the default there will make a difference.

1) Have you tried copying from Paint and pasting in Word? What result do you get?
2) This obviously isn't a Swing problem at all -- I think you should ask the question in a Microsoft forum.


luck, db
There are no new questions, but there may be new answers.
Tarun Bolla
Ranch Hand

Joined: Jun 20, 2011
Posts: 89
Yeah Darryl Burke, After pasting the image to paint, If i re-copy it from paint and paste it to MSWord, the image remains sharp. The problem is only with direct pasting into MSWord, Outlook etc.,
Edit: I think apart from the normal image data in clipboard, we should maintain some extra metadata in clipboard, which i have no idea on how to start
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4530
    
    5

Ah ok. Then try painting the captured Image to different BufferedImage types before setting it on the clipboard. Some might give better results than others.
Tarun Bolla
Ranch Hand

Joined: Jun 20, 2011
Posts: 89
Darryl Burke wrote:Then try painting the captured Image to different BufferedImage types before setting it on the clipboard

No luck with that Darryl Burke. I tried all types of BufferedImage. But somewhere in the internet i read that windows supports images of format DIB, BITMAP on the clipboard. Unfortunately java will not support either. So i think i must read the specification of DIB or BITMAP and generate it. Ok, i can do that, but which Class Object should i create for that purpose? How do i send it to clipboard? What do you think? And i dont want to use JAI
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
as I mentioned earlier, paste special works fine.

is there a reason ctrl-alt-V + [enter], instead of ctrl-V, is a problem?
Tarun Bolla
Ranch Hand

Joined: Jun 20, 2011
Posts: 89
Michael Dunn wrote: is there a reason ctrl-alt-V + [enter], instead of ctrl-V, is a problem?

I am trying to develop a set of nifty tools in which screen capture is one. I cant tell people who use it to do "paste special" instead of "paste".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Image Capture, Buffered Image, Paste in MSWord 2007 problem