views:

1149

answers:

4

I want to put beautiful charts in a report that is available via html and pdf.

I'd prefer to use just one API and that all processing occur server-side.

I want to embed Flash charts in the html version of reports. I want to embed a static image (preferably vector-based format) in the pdf version.

What is the best way to accomplish this?

I've seen a product called Swiff Chart Generator but it's pretty weak on chart interactivity. I've also seen amcharts, which is strong on interactivity, but weak on pdf output.

I'll probably use princexml to handle the overall pdf generation. Princexml doesn't render embedded flash. It does render embedded images and SVG. Another option is flying saucer, which is less feature-full but free.

Corda - They make mapping, and graphing software that supports some amount of interactivity. They support SVG, PNG and flash formats out of the box. Of course, they are quite expensive.

A: 

You can grab the bitmap data of the chart straight from Flash using ActionScript. Unfortunately, I don't believe there is a way to export the vector data.

Abyss Knight
I've seen this approach work on the client-side. I hope to avoid setting up some elaborate mechanism for accomplishing the same thing on the server-side.
schwerwolf
A: 

I did something similar 8 years ago with a java library from Visual Engineering. It looks like their products have changed but someone has their old demos online.

It worked well as an applet for HTML output and i wrote some simple java class to write a .png to embed in the pdfs on the server. Strangly enough it was all called from PHP but hung together well.

Java was a good choice as this had to work on Sun and Linux servers with IE front ends. Unfortunately this isn't Flash and isn't vector based. I'd be looking for tools like swf2jpg or swf2png.

However if there are no other options for server side flash you may want to consider using a Java applet / application combo.

Mark Nold
+1  A: 

Take a look at AlivePDF. I believe it can do what you need. They have a demo where you can export and download a pdf of the swf you have just drawn into, very cool.

Alternatively here is a Jpeg Exporter by the same folks.

EDIT: Also take a look at Degrafa for charting in Flex. It's very good, and the underlying code is actually being folded into Adobe's next release!

defmeta
A: 

You can use FusionCharts

It allows you to embed Flash charts in HTML pages and the same can be exported as image/PDF easily, which you can them embed in your PDF report.

A demo of the same which might be of help to you: http://www.fusioncharts.com/Demos/ExportChart/

Hope this helps:)

I'd like to see a demo of this functionality used to embed a high quality chart in PDF document. The referenced demo is only good for low-quality bitmaps.
schwerwolf