tags:

views:

96

answers:

3

I want to know if anyone has successfully printed something from Flex.

By successful I am talking about some sort of report or document or whatever.

I know its fairly simple to print a component(which is a bit cheap) from Flex by using the printJob() class and passing a component. But I want to pass an object like a list or XML to printJob().

+1  A: 

How do you want your object to look in the printout? And how do you expect Flex to know that? How can you expect Flex to print out an object with no visual representation?

As best I understand most people will give up trying to do printing in Flex and pass such objects to the backend and use something (such as iText or ColdFusion ) to generate a PDF.

Of course, whether doing this in the backend, or with Flex, you'll still have to write the formatting code.

I'm sure you can extend the PrintJob class to accept an object and format it for printing before actually printing.

www.Flextras.com
Thank you for the answer. Currently I am using JasperReports on the backend to handle the print functionality that I need. The reason why I asked this is because I am curious as to whether Flex is indeed able to handle something like this. And whether this is a functional report or just a printout of a grocery list doesnt matter, I just want to know
Pieter van Niekerk
A: 

http://livedocs.adobe.com/flex/3/langref/mx/printing/FlexPrintJob.html

The best way is to handle it through Backend. But again you can use ActionScript to print your object contents. Have you heard of BitmapData Class.

http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.html

With this you can read pixel by pixel and send to printer to print the Object.

Vinothbabu
+1  A: 

AlivePDF seems to be gaining steam in the community, give it a look.

jcelgin
Will certainly have a look at this
Pieter van Niekerk