• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Convert rtf File to jpg File

 
Ranch Hand
Posts: 2216
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any way, using Java, to convert a rtf file to a jpg file on the fly?

My web app shares a set of files with a Windows app. The windows app displays the rtf in an ole box on a report when viewed.

I am using JasperReports to generate a PDF file for report viewing and printing. I cannot find a way to attach the rtf to the JasperReport. I know it can handle images so i thought that if I could convert rtf to jpg on the fly it might solve my issue. Right now at least on the view part I append a HyperLink to the rtf but this is not the users expectations.
 
Steve Dyke
Ranch Hand
Posts: 2216
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I sure could use some direction for this issue.
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
RTF is a text format, isn't it?

About the only thing I can imagine you could do is use the java printing API to print to a PDF, and then convert the PDF to an image somehow.

But it seems like an incredibly round-about way to go about it.

Can you not access the data from which the RTF was generated?

J
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The best I can think of is to display the RTF in a Swing component (the class is called RTFEditorKit), and then to take a screenshot using the Robot class. I'm not sure that that would work on a server, or that the screenshot would include the parts not visible in the Swing window, but it might be worth a try.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic