Flex Printing Problem
Posted on 2008-11-19
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.
Header <Chart Heading>
Header <Static Header>
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.