I have a flex application and one of the modules generates a huge tree graphical component on the screen. There is a “Print” option to print the tree in the paper. Is it possible to print the whole tree in multiple papers? Currently we are printing this in a single paper which is not readable. Client wants to print the whole tree in multiple papers.
Currently we are creating a image of it and sending to the printer for printing. Check the below code:
private function getImage():Image
var image:Image = new Image();
switch( target.selectedItem.@value.toString() )
node = tree;
node = tree.getTreeItem( model.nodeManager.selectedNode ).container;
var bitmapWidth:int = node.width + 20;
var bitmapHeight:int = node.height + 20;
var scalingRatio:Number = 1;
// BitmapData only supports maximum size of 2880x2880 pixels.
if ( (bitmapWidth > 2880) || (bitmapHeight > 2880) )
// determine which dimension we'll have to scale by, width or height
if ( bitmapWidth > bitmapHeight )
scalingRatio = 2880 / bitmapWidth;
bitmapHeight = 2880 * bitmapHeight / bitmapWidth;
bitmapWidth = 2880;
scalingRatio = 2880 / bitmapHeight;
bitmapWidth = 2880 * bitmapWidth / bitmapHeight;
bitmapHeight = 2880;
//buffering image here by 10 px on each side due to the grouping arround nodes not included in layout
bitmap = new BitmapData( bitmapWidth, bitmapHeight, false, 0xffffff );
bitmap.draw( node, new Matrix( scalingRatio, 0, 0, scalingRatio, 0, 0 ) );
image.source = new Bitmap( bitmap );
tree.scaleX = treeScaleX;
tree.scaleY = treeScaleY;
Can it posible to generate multiple images based on width and height and send to the printer?
I will appreciate if you have other suggetions. See the attachment for your ref.
I wanted to know how you created your tree. I need to do something exactly like that; having mulitple children per node. Did you use the tree? What built in components did you use? Did you have to make many custom components? Right now, I'm having to draw my own lines and draw the tree using the actionscript draw funcitons. I have 2 days or so of experience with doing tutorials. I am very new to Flex. Hints and ideas are welcomed.