Home  >  

Printing with Flex

Author photo
AddThis Social Bookmark Button

Printing is not really a strong point of Flex. Have you ever tried to print complex documents? Do reports always look fuzzy and take forever to actually print?

On the quest to print high-quality reports with Flex I wanted to overcome mainly the following issues:

  • Print-outs are basically giant images and take a long time to print.
  • Print-outs simply look fuzzy and their quality is not sufficient for high-quality documents.
  • Text is embedded within the image and is not printed by using the native fonts in printer or OS.
  • Highlighting of text if printed into PDF is not possible.
  • Formatting tables with dynamic sizes or page margins, paper sizes, documents across multiple pages, etc. are very challenging.

So far, I have been able to find the following solutions to print in Flex:

  1. Native printing with the issues listed above
  2. Printing based on JasperReports: http://flex.org/software/component/xviewer
  3. FlexReport: http://flexreport.riaforge.org
  4. AlivePDF: http://code.google.com/p/alivepdf

I have to admit I'm a little biased after playing around with these and I'm very much in favor of AlivePDF. That is the first tool I came across that solves all the issues I mentioned. FlexReport is great, too, but you still print giant images with fuzzy text. Printing based on JasperReports doesn't seem to get a lot of support and would require a tremendous amount of back-end infrastructure.
AlivePDF, however, very elegantly generates PDF files. Printing is suddenly fast again and reports actually look the way you would expect a report to look like. You can select text within the PDF, etc - you basically get all the benefits of PDF. Best of all there is a ton of excellent examples and it's completely free.
Finally, on a side-note we are currently integrating AlivePDF into our own Flex business framework (see www.comparatio.com ). Things like printing an order confirmation, invoices or other documents from Flex are not causing raised eyebrows anymore when looking at a print-out.

Read more from Jan Poehland. Jan Poehland's Atom feed

Comments

13 Comments

Michael McConnell said:

I've had a lot of success with the (free) CFReport Builder. It gets a lot of bad press for being buggy, but I find it very flexible and easy to use. Granted, I'm not generating and printing insanely complex reports, but for most jobs I think it is more than adequate. Of course, if you have no CF server in your Flex application mix, CFReport Builder won't work for you.

I had no idea there were so many other solutions for reporting out of Flex. I'm going to check those out. Thanks for the post.

Chris said:

What about BIRT too - that includes support for .DOC exports which Jasper doesn't as far as I know.

Charles Dale said:

Also remember that most fuzzy text occurs because FlexPrintJob.printAsBitmap defaults to true. Setting it to false makes text look great:

printJob.printAsBitmap = false

Not that this avoids all the other problems...

Rajeev said:

We face a challenge with printing with Flex. Our charts (using flex charts) look fantastic in the flex on browser.

But we also need to generate the same reports in back-end and email to user. Is there a way to run Flex client in "headless" (like java AWT) mode? or do something to get those images on backend ? Our current approach is to do them in Jasper on server - but that is double the work and quality is downgraded. Flex charts are more beautiful than BIRT.

Jan Poehland said:

Rajeev,
Check out the demos we have at www.comparatio.com.
You can switch almost all Flex applications into headless/full-screen mode.
Don't know about printing charts on AlivePDF (yet) but there should be a way to export them as bitmap and print based on that.

Paul said:

I was charged with finding a reporting solution for our company's fledgling Flex development and, yeah, AlivePDF takes the cake. It has a ways to go (as does printing in Flex) but is progressing nicely. Thibault Imbert (its creator) responds well to the community.

Anonymous said:

Can anybody tell me please:
How to get "Text Report" from Flex program?
Initially the program is showing on flex only. But for printing, we want the report on text format.

S.S.ROy

Anonymous said:

You could simply create a text box and dump the output in there

srayker said:

We have integrated AlivePDF in our project. Frankly we found it to be the easiest and flexible. I only wonder why Adobe is not putting enough efforts on this front when both Flash and PDF are their our children.

Regards.

Seva said:

Hey Jan, I am sure thing also looking for a printing solution in Flex (preferably with no server trips at all); why else would I be here. I've tried using AlivePDF, but the only "printing" functionality I got is printing to a PDF file. In other words, I can save my data to a PDF file, but the end user still has to do printing himself as an extra step, which is not what I want.

It wasn't clear for me from your article, whether you guys figured out the way to print to a printer directly using AlivePDF or whether you are talking about generating good quality PDF and letting users do printing themselves.

Did anybody figure out the way to print directly to a printer? Any help or suggestions would be appreciated.

Thanks,
Seva

Jan Poehland said:

We are not starting the print job directly. You are right - we simply create the PDF and leave it to the user to actually print. I guess this is a small price to pay compared to the benefits you get with AlivePDF. Not sure if we could open the PDF in a separate frame (if it is stored on the server) and call a print function from there - might be worth a try.

Seva said:

Thank you Jan.
I was afraid that would be your answer. I will definitely explore all options, but in the end I need to end up with print job to a printer without extra user involvement.

Blake said:

Hey everyone. I just started using a component called BentBit Report and it is AWESOME! It has everything I need to allow my users to print and browse reports. The url is http://www.bentbit.com/?goto=main/product.asp

Leave a comment


Tag Cloud

Question of the Week: Dream App

If you had an unlimited budget and unlimited resources what application would you build and why would you build it?

Answer

Latest Features

Recommended for You

@InsideRIA on Twitter

Archives

  • Or, visit our complete archive.  

About This Site

Welcome to the premiere community site for all things RIA sponsored by O'Reilly Media and Adobe Systems Incorporated.