• Home
  • Products
  • Technology
  • Experience
  • Services
  • Our Company
  • Blog

Archives

  • February 2009
  • May 2008
  • April 2008
  • March 2008
  • December 2007
  • November 2007
  • October 2007
  • August 2007

Categories

  • Adobe AIR
  • Adobe Flex
  • Cairngorm
  • Encryption
  • General
  • Printing
  • UndoRedo Framework
  • Bookmarks

    • Adobe Labs
    • Planet Ubuntu

Log in
Print Preview Component, Call for Testers

Many people have complained or indicated that they need or would like a print preview component. FlexReport seems to have had a short lifetime and the demo site has recently been suspended, so it’s no longer an option. We at Soph-Ware Associates, Inc. recently needed such a component — so we wrote one. Try it out here!

A Brief Warning

This is not even a pre-release, rather it’s a call for testers and release of some code, as-is, no-warantees, expressed-or-implied, etc. This release is not fully documented and should probably be considered an alpha release, although I believe it’s stable and useful.

Features and Implementation

This print preview component provides the ability to preview your document, zoom in or out, change between pages and, of course, print.

In order to use it, simply create a component that implements the com.sophware.printing.IPrintableDocument interface. That document can be a single component that uses something like PrintAdvancedDataGrid to handle the pagination, or a component that really aggregates a set of components into a single document, displaying the correct child component at the time nextPage or previousPage is called. It doesn’t really matter how it’s implemented, as long as that component behaves as expected.

Unlike FlexReport, the print preview is generated dynamically by Flex without resorting to rendering to a bitmap, so there isn’t any ugly pixelization (unless the component is designed that way).

A Flash Player Bug, Testers Needed

We haven’t had the time to do much polishing, and the version that I’m posting is scaled down a bit (no PDF support, etc.), but we hope you find it useful. It is serving us well, with one exception — there appears to be a bug in playerglobal.swc for Flash Player 10 that effects Internet Explorer and occasionally some other browsers.

Details of the bug report are available here. Despite the brevity of the bug report, we’ve worked extensively with Adobe (special thanks to Leah Zagreus who worked hard to try and isolate it on Adobe’s systems) and haven’t been able to make any progress.

We can reproduce this bug every time on our machines, but Adobe can’t. In order for us to reproduce the issue, we have to require version 10 of Flash Player. By passing -target-player 10.0.0 to mxmlc when compiling using mxmlc, we often see a part of the document obscured in the printout, despite a perfect preview:

Band appears horizontally across page, obscuring content.

Band appears horizontally across page, obscuring content.

We’ve seen the bug on both Windows and Macintosh and under Firefox, Internet Explorer, and Safari. For us, it’s consistently reproducible under Internet Explorer (7 and 8) and Safari.

So, if you’ve been needing a print preview component and/or could test this out on your browser and leave a comment if you see it, please do! If we can resolve this issue soon, we might still have some time to make this into a high-quality, production-ready component.

If you’d like, download the source here.

Posted by Kaleb Pederson on February 16, 2009 at 3:28 pm
8 Comments or LinksAdobe Flex, Printing
  1. 1
    Fedir
    September 14, 2009 at 3:52 pm

    Dear Kaleb, I found interesting your PrintPrewiev control. I have a question that i cant solve several weeks. My document contains 6 similar pages with only different photo and label from array that linked to “currentpage”. The control draws all the stuff perfectly, but when i send it to pdf printer, loop “while(document.validNextPage)” causes document dosnt have enough time to complete creation of image on page and all pages of resulting pdf are similar to first one. How to solveit?

  2. 2
    Kaleb Pederson
    September 18, 2009 at 2:52 pm

    Flex currently has a 60 second timeout on print jobs, so do as much processing as you can before you actually start printing. Two different things will likely help:

    1. Lower both the desiredHeight and desiredWidth attributes. By making these smaller, the page you’re printing won’t need to be scaled down as much.
    2. When converting to a PDF, use a lower DPI/resolution. We chose to go with a resolution that allows us to zoom in between 200 and 300% before we see degradation. Using a higher DPI allows better zooming but otherwise slows processing down.

    Good luck.

  3. 3
    Fedir
    September 24, 2009 at 10:58 am

    Dear Kaleb,
    Thank you for detailed answer. Still cannot solve a problem. My example is very simple. I set number of pages to 6 and I have modified “NextPage” function of the printable document. Modified NextPage simply changes source of an ImageBox on a page. As a result I have 6 pages with different Images near the text. Then I run an application and easily navigate Next page until i reach last one. The code works and pages are properly diplayed inside a popup window. However, when I press “print” button, final PDF or print-out either does not contain picture or contains all the same pictures identical to first one. The reason, that all the functions are immediately (less than 2 seconds) performed without waiting for document to be entirely rendered. I tried to remove images and leave only text. It works fine, but when i place images, the print-outs are wrong.

  4. 4
    Abdul Areef
    February 3, 2010 at 11:53 pm

    Hi,
    I have tried ur concenpt in my Application, its working fine. but i am facing problem in Print Prreview.

    I have lengthy value in some of the datagrid column, so i could not see the values fully in the print preview, but i can see those things in paper.

    i tried with variablerowheight and wordwrap in datagrid, still the problem exist !

    if u have any idea kindly share with me.

    regards
    areef

  5. 5
    Kaleb Pederson
    February 4, 2010 at 10:11 am

    Areef, I’m not sure why the preview would show something different from the printout, aside from some font embedding issues that don’t seem related. You might try asking on the Flex Coders mailing list.

  6. 6
    Ka Wing
    February 11, 2010 at 12:07 am

    Hi,
    I would like to ask how to remove the “flex data visualization trial”. Thank you

  7. 7
    Kaleb Pederson
    February 11, 2010 at 10:02 am

    You get a license of the Flex Data Visualization packages when you buy Flex Builder Pro. The print preview component doesn’t require the data visualization components, although my example does. You can easily create print previews without using that component set.

Incoming Links

  • 菲克斯咨询 » Blog Archive » 2月第三周精华博客

Trackback this post | Subscribe to the comments via RSS Feed