# Convert Flash to Image

**URL:** <https://www.ruby-forum.com/t/convert-flash-to-image/133814>\
**Category:** Rails\
**Created:** [April 3, 2008, 10:29pm UTC](https://www.ruby-forum.com/t/convert-flash-to-image/133814 "2008-04-03T22:29:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisdwan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7feea3/32.png) [@chrisdwan](https://www.ruby-forum.com/u/chrisdwan)\
**Post date:** [April 3, 2008, 10:29pm UTC](https://www.ruby-forum.com/t/convert-flash-to-image/133814/1 "2008-04-03T22:29:26Z")

</div>

I am currently in the process of converting a report rendered in HTML to  
PDF using the PDF::Writer tool.

In the report is a Flash object called FushionChart which is a dynamic  
chart that is rendered client side by the flash player using a given XML  
feed. Now I would like to create an image from this chart and place it  
in the PDF file.

I already have code that generate the needed HTML to draw the flash and  
the XML feed in a helper so I am going to guess that I need to draw this  
flash object serverside, and then export the image.

How am I going to do this in Ruby on Rails?

---

<div class="post-metadata">

**Author:** ![chrisdwan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7feea3/32.png) [@chrisdwan](https://www.ruby-forum.com/u/chrisdwan)\
**Post date:** [April 3, 2008, 11:19pm UTC](https://www.ruby-forum.com/t/convert-flash-to-image/133814/2 "2008-04-03T23:19:23Z")

</div>

Chris D. wrote:

> I am currently in the process of converting a report rendered in HTML to  
> PDF using the PDF::Writer tool.
> 
> In the report is a Flash object called FushionChart which is a dynamic  
> chart that is rendered client side by the flash player using a given XML  
> feed. Now I would like to create an image from this chart and place it  
> in the PDF file.
> 
> I already have code that generate the needed HTML to draw the flash and  
> the XML feed in a helper so I am going to guess that I need to draw this  
> flash object serverside, and then export the image.
> 
> How am I going to do this in Ruby on Rails?

I suggest looking in the FusionCharts documentation. There’s a folder  
called “Saving Chart as Image” that can probably help you out. You’ll  
probably have to use javascript for converting it to an image, but  
that’s a good place to start.

---

<div class="post-metadata">

**Author:** ![chrisdwan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7feea3/32.png) [@chrisdwan](https://www.ruby-forum.com/u/chrisdwan)\
**Post date:** [April 10, 2008, 6:35pm UTC](https://www.ruby-forum.com/t/convert-flash-to-image/133814/3 "2008-04-10T18:35:54Z")

</div>

Mark Mr wrote:

> I suggest looking in the FusionCharts documentation. There’s a folder  
> called “Saving Chart as Image” that can probably help you out. You’ll  
> probably have to use javascript for converting it to an image, but  
> that’s a good place to start.

Thanks for your reply, I actually first looked into that possibility but  
the problem is that that requires an invocation from the client side  
after the rendering has been done. This is not possible when the PDF is  
generated purely serverside.

I have found 1 topic that talks about the possibility to render a static  
image serverside, in ruby even, but that solution has a lot of problems  
on Windows machines and lacks documentation in crucial areas which I was  
unable to figure out on my own.  
[http://www.fusioncharts.com/forum/Topic724-28-3.aspx?Highlight=ruby](http://www.fusioncharts.com/forum/Topic724-28-3.aspx?Highlight=ruby)
