Skip navigation
Currently Being Moderated

FlexPrintJob produces print output missing large blocks of text

Apr 19, 2011 12:57 PM

Hi All,

 

I'm using FlexPrintJob to generate print output from a Flex app.  I'm allowing the user to print off the "thank you" view of our app.  Here's the code that fires when the "Print" button is clicked in my app:

 

var printer:FlexPrintJob = new FlexPrintJob();
printer.printAsBitmap = false;
// Display the print dialog to the user.  If they choose a printer
// and click "print", this method will return true, and we will
// spool the job to the printer they selected. If they hit cancel,
// this method will return false, and we will not attempt to send
// anything to the printer.
if(printer.start()){
     printer.addObject(itemsToPrintContainer);
     printer.send();
}

 

 

itemsToPrintContainer is fairly text-heavy, and contains all the information that the user has entered so far, along with some "fine print" courtesy of our legal department :-)  Depending on the options the user chose and how much they typed, this will run between 1.25 pages, and a full two pages of print output (when printed to 8.5"x11" paper with a 1" top, bottom, and side margin).

 

Something very strange is happening, however.  Only the first two-thirds of the text are printed.  All the text after that is missing, even though it is present in the view.  Additionally, the horizontal rules that separate different blocks of text are present, and are spaced appropriately.  E.g., if there is a long block of text missing, the space between the horizontal rules is exactly appropriate to fit that long block of text, even though it's not displayed.  Similarly, where there are short blocks of text missing, the space between the horizontal rules is appropriate to fit that short block of text.

 

The horizontal rules are a simple component I created to draw a horizontal line.  Looks like this:

 

     <s:stroke>
          <s:SolidColorStroke color="{color}" weight="{weight}" alpha="{ruleAlpha}"/>
     </s:stroke>

 

After some experimenting, I've discovered that's what printed has something to do with what's visible in the viewport.  The object I'm trying to print is in a scrollable viewport, and what prints is close to the same height as what's visible in the viewport.  If I resize the window to make the visibile area smaller, the amount of text that prints gets smaller.  However, what prints is not exactly what is in the viewport--I'm sure it's related somehow, since the amount of visible text (measured vertically) is consistently related to the viewport size.  But it isn't exactly the same.  Sometimes there is something visible in the viewport on screen that doesn't appear in the printed output, and vice versa.  But what prints changes when you scroll the viewport up and down.

 

Any suggestions?  How can I get it to print the entire itemsToPrintContainer object, with all text, regardless of what's currently visible on the screen?

 
Replies
  • Currently Being Moderated
    Apr 19, 2011 3:01 PM   in reply to JoshBeall

    That's a known bug.  If you can take the container outside of all scrollers

    then it should print.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 19, 2011 10:00 PM   in reply to JoshBeall

    Hi,

     

    I faced similar issues while trying to print a VGroup inside a scroller and had to use MX controls to get the page printed correctly. This is against the rules (?) but works for me

     

     

    from

     

    <s:Scroller width="100%" height="100%">
              <s:VGroup id="container" width="100%"/>
         </s:Scroller>

     

     

    to
         
         <mx:Canvas width="100%" height="100%">
              <mx:VBox id="container" width="100%"/>
         </mx:Canvaswidth>

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 19, 2011 10:47 PM   in reply to JoshBeall

    Why would it need to be in a scroller at the time you submit the print job?

    Flash is a deferred renderer.  You can manipulate the display list, submit

    the page and restore the display list and the user will not see it.

     

    Or clone the page somewhere, print it, and remove the clone.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 20, 2011 9:44 AM   in reply to JoshBeall

    I only know of an internal bug. It is assigned for fixing right now.  If I

    find time, I'll create a public bug for it.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 20, 2011 10:01 PM   in reply to JoshBeall

    The player engineer says that it is related to this bug:

    http://bugs.adobe.com/jira/browse/FP-6167

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points