Yordan Yanakiev
Yordan Yanakiev

Reputation: 2604

Flex : Print a Chart?

I wish to print a chart. I do as follow :

var printJob : PrintJob = new PrintJob();

if ( printJob.start() == false )
    return;

var printOptions : PrintJobOptions = new PrintJobOptions( true );

printJob.addPage( lineChart, null, printOptions );
printJob.send();

but as a result i am receiving only 1 page which containing only some part of the chart.

Upvotes: 0

Views: 609

Answers (2)

user1267710
user1267710

Reputation:

Alive PDF or Pure PDF or FxPDF is one of the best solutions to create cutom printings.

http://alivepdf.bytearray.org/

http://code.google.com/p/purepdf/

Upvotes: 2

Ben
Ben

Reputation: 531

You only get one page because you add only one page:

printJob.addPage( lineChart, null, printOptions );

Your chart clip must fit on a page, A4 dimension in pixels should fit in width:559 x height:842.

You can check the dimensions of your chart clip, when it is bigger then the A4 you can scale it accordingly (don't forget print margins). To scale a movielclip you can use scaleX or scaleY, but changing the width or height of the container works better for me, because pixel values are easier then calculating the scale.

You can also create a print template clip, so instead of printing the chart clip immediately you place the charts on a new clip, that way you have more control over the page you are printing. It will also be easier to add more pages to the printjob.

Upvotes: 1

Related Questions