Flex Printing Problem

Our application is using some components which are placed in the main mxml file. We form a LineChart which internally has many different objects and components for its composition. We display this chart on left hand side of the window.


Also we have some data which we add in a datagrid in the same main mxml and display this data grid on the right hand side of window.


The requirement is to print these things in following order.


First Page

Header <Chart Heading>
Line Chart

Second Page

Header <Static Header>
Data Grid

In Flex, We have two apis which I think could be used to achieve this.

FlexPrintJob   and    PrintJob


To use FlexPrintJob, there is a method to addObject() for printing, but every new object added goes on a new page, so instead of two pages, four pages are printed.


To use PrintJob,  there is a method to addChild() for printing , but when the line chart and datagrid are added as child they are removed from the UI because the object  itself is added when we call addChild() and not the reference. For bypassing this, if we take a snapshot of this chart and datagrid and convert it to an image for printing, it is not getting printed because the image object has the data of the image which is not actually displayed on the UI. So this approach also doesnt work.


We also tried a TitleWindow approach by using its visible and alpha properties, which is not helping.


If you have come across such situation and could kindly hint us on the same, It would be really helpful as this is very critical issue for the release to happen.

Who is Participating?
evcrConnect With a Mentor Commented:

Using the first option (FlexPrintJob). What happens if you put the objects inside a canvas then AddObject the canvas to the printJob?
did that work?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.