<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Tutorial &#187; Flex Print</title>
	<atom:link href="http://flextutorial.org/category/flex-print/feed/" rel="self" type="application/rss+xml" />
	<link>http://flextutorial.org</link>
	<description>Rich Internet Application Development by Adobe Flex</description>
	<lastBuildDate>Fri, 11 Dec 2009 05:54:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Understanding Flex Print Job from A to Z</title>
		<link>http://flextutorial.org/2009/06/23/understanding-flex-print-job-from-a-to-z/</link>
		<comments>http://flextutorial.org/2009/06/23/understanding-flex-print-job-from-a-to-z/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 02:05:34 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Flex Print]]></category>
		<category><![CDATA[FlexPrintJob]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[print multiple pages]]></category>

		<guid isPermaLink="false">http://flextutorial.org/?p=550</guid>
		<description><![CDATA[What is FlexPrintJob In Flex, you usually do printing in your application through FlextPrintJob. According to Adobe, FlexPrintJob is: A class that prints one or more objects Automatically splits large objects for printing on multiple pages Scales the output to fit the page size FlexPrintJob vs. Flash PrintJob FlexPrintJob is a new print class introduced [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff6600;"><strong>What is FlexPrintJob</strong></span></p>
<p>In Flex, you usually do printing in your application through <strong>FlextPrintJob</strong>.</p>
<p>According to Adobe, <strong>FlexPrintJob </strong>is:</p>
<blockquote>
<ul>
<li>A class that prints one or more objects</li>
<li>Automatically splits large objects for printing on multiple pages</li>
<li>Scales the output to fit the page size</li>
</ul>
</blockquote>
<p><span id="more-550"></span></p>
<p><span style="color: #ff6600;"><strong>FlexPrintJob vs. Flash PrintJob</strong></span></p>
<p><strong>FlexPrintJob </strong>is a new print class introduced by Adobe for Flex. In Flash, there is a similar one, named <strong>PrintJob</strong>.</p>
<p>Here is how you call <strong>FlexPrintJob </strong>in <strong>Flex</strong>:</p>
<blockquote>
<pre><strong><span style="color: #0000ff;">flexPrintJob.addObject(myPrintObject,scaleType</span></strong><span style="color: #0000ff;"><strong><span style="color: #0000ff;">)</span></strong></span><strong>
- <span style="color: #000000;">myPrintObject </span></strong>is the UIComponent you want to print
- <span style="color: #000000;"><strong>scaleType </strong>specifies </span>how to scale UIComponent to fit print page
  (e.g. matchWidth, matchHeight, fillPage, showAll)</pre>
</blockquote>
<p>To compare, here is how you call <strong>PrintJob </strong>in <strong>Flash</strong>:</p>
<blockquote>
<pre><strong><span style="color: #0000ff;">printJob.addPage(Sprite(myPrintObject), rectangle, printJobOptions)</span></strong>
- <span style="color: #000000;"><strong>myPrintObject </strong></span>is the UIComponent you want to print
<strong>- <span style="color: #000000;">rectangle </span></strong>is the print area defined by a rectangle
<strong>- <span style="color: #000000;">printJboOptions </span></strong>specifies print as a BitMap or in Vector format</pre>
</blockquote>
<p>So, what is the relationship between those two print classes?</p>
<blockquote><p>FlexPrintJob is actually a <strong>wrapper </strong>for PrintJob class.</p></blockquote>
<p>What does a <strong>wrapper </strong>class mean in this case? It means:</p>
<blockquote><p>1.  FlexPrintJob eventually calls Flash PrintJob to finish the printing task.</p>
<p>2.  FlexPrintJob enhances the Flash PrintJob and simplifies its usage.</p></blockquote>
<p><span style="color: #ff6600;"><strong>What is new in FlexPrintJob</strong></span></p>
<p>Adobe claims that <strong>FlexPrintJob </strong>automatically <strong>slices large object for printing on multiple pages </strong>and <strong>scales the output to fit the page size</strong>.</p>
<p>To do so,  <strong>FlexPrintJob </strong>wraps the old Flash <strong>PrintJob </strong>in the following 8 steps:</p>
<blockquote><p>Step 1:  Convert percentage width or height to explicit width or height</p>
<p>Step 2:  Calculate Scale Ratio based on Print Page Size and ScaleType (e.g. matchWidth)</p>
<p>Step 3:  Scale the print object to the required value</p>
<p>Step 4:  Find the number of pages required in vertical and horizontal</p>
<p>Step 5:  Create the print area in a shape of rectangle</p>
<p>Step 6:  Specify Print Options (BitMap or Vector)</p>
<p>Step 7:  Call Flash PrintJob to print each page</p>
<p>Step 8:  Restore from explicit width or height to percentage width or height</p></blockquote>
<p><span style="color: #ff6600;"><strong>What is missing in FlexPrintJob</strong></span></p>
<p><strong>FlexPrintJob </strong>enhances the Flash <strong>PrintJob </strong>in terms of scaling the output to fit the page size. However, is it good enough to print large object on multiple pages?</p>
<p>Maybe&#8230; as long as you don&#8217;t mind <strong>cutting text in half</strong> or <strong>printing only 5% content of TextArea or DataGrid</strong>.</p>
<p>As a matter of fact, to really support multiple pages printing in Flex, it need to resolve the following 3 issues:</p>
<blockquote><p>1. How to scale display objects from screen to printer?</p>
<p>2. How to print the full content of Scrollable Components such as TextArea or DataGrid?</p>
<p>3. How to find the right page breaker to avoid cutting objects (e.g. Text or Image) in half?</p></blockquote>
<p>Through the implementation of <strong>FlexPrintJob</strong>, it does not provide good answers to<strong> issue#2</strong> and <strong>issue#3</strong>. Therefore, when come to printing multiple pages in Flex, you often need extra helps like <a title="Printing Multiple Pages Using PrintDataGrid" href="http://flextutorial.org/2009/05/28/printing-multiple-pages-using-printdatagrid/">PrintDataGrid</a> or <a title="Printing Multiple Pages using FlexReport" href="http://flextutorial.org/2009/06/02/printing-multiple-pages-using-flexreport/">FlexReport</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://flextutorial.org/2009/06/23/understanding-flex-print-job-from-a-to-z/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Printing Multiple Pages using FlexReport</title>
		<link>http://flextutorial.org/2009/06/02/printing-multiple-pages-using-flexreport/</link>
		<comments>http://flextutorial.org/2009/06/02/printing-multiple-pages-using-flexreport/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 21:39:38 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Flex Print]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[FlexReport]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[print multiple pages]]></category>
		<category><![CDATA[PrintDataGrid]]></category>
		<category><![CDATA[PrintText]]></category>

		<guid isPermaLink="false">http://flextutorial.org/?p=412</guid>
		<description><![CDATA[What is the problem In the previous tutorial, we saw How to Print Multiple Pages Using Flex PrintDataGrid. It works fine when your application just contains one big DataGrid. In the real world, however, you often need a combination of contains and controls like VBox, HBox, Text, Image, plus DataGrid. Then guess what? You still [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff6600;"><strong>What is the problem</strong></span></p>
<p>In the previous tutorial, we saw <a title="Printing Multiple Pages Using PrintDataGrid" href="http://flextutorial.org/2009/05/28/printing-multiple-pages-using-printdatagrid/">How to Print Multiple Pages Using Flex PrintDataGrid</a>. It works fine when your application just contains one big DataGrid. In the real world, however, you often need a combination of contains and controls like <em>VBox, HBox, Text, Image,</em> plus <em>DataGrid</em>. Then guess what? You still have trouble with the Flex print job.</p>
<p>In fact, this is not the only challenge you are facing&#8230; How about the  <strong>Print Preview</strong> function? Why do you need it? Because we are in recession! Oh, yeah, your boss would try to squeeze every penny for the sake of Cost Reduce. No one likes to see you print 100 pages then realize it is a wrong report. Plus saving paper is good for our mother earth.</p>
<p>Unfortunately,  till Flex 3,  Adobe has not provided a good solution to either Multiple Pages Printing or Print Preview (without client-side installation like PDF Printer).</p>
<p><span id="more-412"></span></p>
<p><span style="color: #ff6600;"><strong>FlexReport</strong></span></p>
<p>As I mentioned before, my first Flex job was to find a better way to print multiple pages. So I did a lot of research on the 3rd party solutions. I was quite frustrated at that time. It seemed like everyone was focusing on Flex Layout, Animation, and Backend System Integration. Nobody cared about such a lower level job &#8211; Print. No wonder Adobe is not in hurry to provide a better support for Flex Print.</p>
<p>Finally, there was one open source project got my attention. It&#8217;s called <strong>FlexReport</strong>. After thoroughly reviewed its source code and demo application, I would have to say FlexReport is by far the closet solution to the Flex Print problem.</p>
<p>You can find the information about the FlexReport from the following URLs:</p>
<blockquote>
<pre><strong>1. FlexReport Introduction</strong>
   <a title="FlexReport Introduction" href="http://www.kemelyon.com/bts/2008/01/14/flexreport/">http://www.kemelyon.com/bts/2008/01/14/flexreport/</a>

<strong>2. FlexReport Demo Application</strong>
   <a title="Flex Report" href="http://www.kemelyon.com/flexreport/0_2rc1/">http://www.kemelyon.com/flexreport/0_2rc1/</a>

<strong>3. FlexReport Source File Download</strong>
   <a title="Flex Report" href="http://www.kemelyon.com/flexreport/srcview/FlexReport.zip">http://www.kemelyon.com/flexreport/srcview/FlexReport.zip</a>

   <span style="color: #ff6600;">Notes:
   If you counter any troubles to run the original FlexReport
   from the above link. You can <a title="Download FlexReport Demo" href="http://flextutorial.org/wp-content/uploads/2009/06/flexreportdemo.zip">Download My Working Version Here</a>.
   I fixed some class reference problems and ran it fine in Flex 3.</span></pre>
</blockquote>
<p><span style="color: #ff6600;"><strong>How can FlexReport help you<br />
</strong></span></p>
<p>The best way to see how much <strong>FlexReport </strong>can help you is to <strong>Try It</strong>. Download a copy and run it in your Flex Builder.</p>
<p>I found FlexReport was pretty cool in the following 3 areas:</p>
<blockquote>
<pre><strong>1. Print preview</strong>
   Provides a nice preview by generating print pages through Bitmaps.
   Has a built-in PDF Printer, No extra software required to end users.

<strong>2. Report layout</strong>
   Creates dynamic reports without knowing how many pages in advance.

<strong>3. Multi-page text printing </strong>
   Except PrintDataGrid, adds a PrintText for long Text printing.</pre>
</blockquote>
<p><span style="color: #ff6600;"><strong>What is FlexReport missing</strong></span></p>
<p>The biggest problem of <strong>FlexReport </strong>is:<strong> </strong>it assumes your Flex Components (Controls and Contains) are mainly<strong> Vertical-Stacked. </strong>For example, you have a  TextArea at the top, then a DataGrid starting after the bottom of the TextArea, then an Image after the DataGrid.</p>
<p>However, many corporate forms are not like that, they usually mix Vertical and Horizontal Layout. For instance, you may have 3 Labels, 2 Text Areas, and 2 Images horizontal-aligned while other 2 DataGrids, 2 Texts, 3 Images vertical-aligned. <strong>FlexReport </strong>might give you some weird results in this case.</p>
<p><span style="color: #ff6600;"><strong>Conclusion</strong></span></p>
<p><strong>FlexReport </strong>is a nice solution to none-critical Flex printing  jobs. It enhances Flex Print function in terms of Print Preview, Report Layout, and Multi-page Text Printing. However,  <strong>FlexReport </strong>still has some issues to handle complex corporate reports especially with mixed Vertical and Horizontal Layout.</p>
<p>So, how can you further improve from <strong>FlexReport</strong>? To do so, you need to know some concepts and implementations of Flex Framework. This will be covered in our next tutorial &#8211; <a title="Understanding Flex Print Job from A to Z" href="http://flextutorial.org/2009/06/23/understanding-flex-print-job-from-a-to-z/">Understanding Flex Print Job from A to Z</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://flextutorial.org/2009/06/02/printing-multiple-pages-using-flexreport/feed/</wfw:commentRss>
		<slash:comments>55</slash:comments>
		</item>
		<item>
		<title>Printing Multiple Pages Using PrintDataGrid</title>
		<link>http://flextutorial.org/2009/05/28/printing-multiple-pages-using-printdatagrid/</link>
		<comments>http://flextutorial.org/2009/05/28/printing-multiple-pages-using-printdatagrid/#comments</comments>
		<pubDate>Fri, 29 May 2009 02:28:05 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Flex Print]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[print multiple pages]]></category>
		<category><![CDATA[PrintDataGrid]]></category>

		<guid isPermaLink="false">http://flextutorial.org/?p=373</guid>
		<description><![CDATA[In the previous tutorial, we knew How to Use Flex Build-in Print Class &#8211; FlexPrintJob. It&#8217;s simple to use. But you may face some challenges when print multiple pages. Here is why: To start to print on a new page, you need to write a code like this: printJob.addObject(targetComponent); It  adds your component to FlexPrintJob. [...]]]></description>
			<content:encoded><![CDATA[<p>In the previous tutorial, we knew <a title="Using Flex Build-in Print Function" href="http://flextutorial.org/2009/05/21/using-flex-build-in-print-function/">How to Use Flex Build-in Print Class &#8211; <strong>FlexPrintJob</strong></a>. It&#8217;s simple to use. But you may face some challenges when print multiple pages. Here is why:</p>
<p>To start to print on a new page, you need to write a code like this:</p>
<blockquote>
<pre><span style="color: #0000ff;">printJob.addObject(targetComponent);
</span></pre>
</blockquote>
<p>It  adds your component to <strong>FlexPrintJob.</strong> But how many pages is it going to take?</p>
<p><span id="more-373"></span></p>
<p>The typical example is DataGrid. It might contains 1 or 1000 records. There is no way we can predetermine the size when binding with a dynamic data provider. Plus how do you know where to put the page break, like record 1-17 on page 1,  18-30 on page 2 &#8230;?</p>
<p>Fortunately, Flex gives you a workaround to solve DataGrid printing issue. Here is how:</p>
<p><span style="color: #ff6600;"><strong>Things You Need</strong></span></p>
<blockquote>
<ul>
<li><strong>mx.printing.</strong><strong>FlexPrintJob</strong></li>
<li><strong>mx.printing.</strong><strong>PrintDataGrid</strong></li>
</ul>
</blockquote>
<p><span style="color: #ff6600;"><strong>Steps You Do</strong></span></p>
<blockquote>
<pre><strong>1. Create a FlexPrintJob Instance</strong><strong>    <span style="color: #0000ff;"> </span></strong><span style="color: #0000ff;">
   var flexPrintJob: FlexPrintJob = new FlexPrintJob();</span>

<strong>2. Start FlexPrintJob
</strong><span style="color: #0000ff;">   flexPrintJob.start();
</span>
<strong>3. Create PrintDataGrid </strong><span style="color: #0000ff;">
   var myPrintData:PrintDataGrid = new PrintDataGrid();
   Application.application.addChild(myPrintData);
</span>
<strong>4. Set PrintDataGrid's DataProvider(from DataGrid), Width, and Height</strong><span style="color: #0000ff;">
   myPrintData.dataProvider = myData.dataProvider;
   myPrintData.width = printJob.pageWidth;
   myPrintData.height = printJob.pageHeight;</span>

<strong>5. Loop PrintDataGrid to Generate Multiple Print Pages</strong><span style="color: #0000ff;">
   printJob.addObject(myPrintData);
   while (myPrintData.validNextPage) {
   	  myPrintData.nextPage();
    	  printJob.addObject(myPrintData);
   }</span>

<strong>6. Print
</strong><span style="color: #0000ff;">   printJob.send();</span></pre>
</blockquote>
<p><span style="color: #ff6600;"><strong>Sample Code<br />
</strong></span></p>
<blockquote>
<pre><span style="color: #0000ff;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute"
    initialize="init()"&gt;

    &lt;mx:Script&gt;
    	&lt;![CDATA[
    	import mx.printing.PrintDataGrid;
    	import mx.printing.FlexPrintJob;
    	import mx.collections.ArrayCollection;

    	[Bindable]
    	public var dataSource:ArrayCollection = new ArrayCollection();

        private var totalRecords:Number = 100;

    	private function init():void {
		for (var i:int = 1; i&lt;=totalRecords; i++) {
    		  var dataObject:Object = new Object();
    		  dataObject.Name = "Name #" + i;
    		  dataObject.Phone = "Phone #" + i;
    		  dataObject.Address = "Address #" + i;
    		  dataSource.addItem(dataObject);
    		}
    	}

    	private function doPrint():void {
    		var printJob:FlexPrintJob = new FlexPrintJob();
    	   	if (printJob.start()) {
       		  var myPrintData:PrintDataGrid = new PrintDataGrid();
     	   	  Application.application.addChild(myPrintData);
         	  myPrintData.dataProvider = myData.dataProvider;
    	   	  myPrintData.width = printJob.pageWidth;
    	   	  myPrintData.height = printJob.pageHeight;

    	   	  printJob.addObject(myPrintData);
    	   	  while (myPrintData.validNextPage) {
    	   		myPrintData.nextPage();
    	   		printJob.addObject(myPrintData);
    	   	  }
    	   	  Application.application.removeChild(myPrintData);

                  printJob.send();
    	        }
    	}

    	]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Panel title="Flex Tutorial - PrintDataGrid"
    	width="500" height="500"
    	horizontalCenter="0" verticalCenter="0"
    	horizontalAlign="center" verticalAlign="middle"&gt;

        &lt;mx:DataGrid id="myData"
            dataProvider="{dataSource}"
            width="400" height="400" /&gt;

        &lt;mx:Button label="Print" click="doPrint()"/&gt;

    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</span><span style="color: #0000ff;">
</span></pre>
</blockquote>
<p><span style="color: #ff6600;"><strong>Conclusion</strong></span></p>
<p>Adobe Flex provides PrintDataGrid to solve the problem of multiple pages printing. It works fine when your application mainly contains one big DataGrid.</p>
<p>However, life is not that simple. In many cases, you need to have a combination of different contains and controls like <em>Canvas, VBox, HBox, Label, Text, Text Area, Image,</em> plus <em>DataGrid</em>. Unfortunately, until Flex 3,  Adobe has not provided any better solution beyond FlexPrintJob and PrintDataGrid.</p>
<p>So, is there any 3rd party solution? I have done a lot of research. Eventually it narrows down to an open source project. This leads to our next tutorial &#8211; <a title="Printing Multiple Pages using FlexReport" href="http://flextutorial.org/2009/06/02/printing-multiple-pages-using-flexreport/">Printing Multiple Pages using FlexReport</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://flextutorial.org/2009/05/28/printing-multiple-pages-using-printdatagrid/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using Flex Build-in Print Function</title>
		<link>http://flextutorial.org/2009/05/21/using-flex-build-in-print-function/</link>
		<comments>http://flextutorial.org/2009/05/21/using-flex-build-in-print-function/#comments</comments>
		<pubDate>Thu, 21 May 2009 17:46:45 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Flex Print]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[FlexPrintJob]]></category>
		<category><![CDATA[print]]></category>

		<guid isPermaLink="false">http://flextutorial.org/?p=314</guid>
		<description><![CDATA[The build-in print function provided by Adobe Flex is actually pretty straightforward. For a single page print, it is good enough. Here is how it works: Things You Need mx.printing.FlexPrintJob Steps You Do 1. Create a FlexPrintJob Instance     var flexPrintJob: FlexPrintJob = new FlexPrintJob(); 2. Start FlexPrintJob flexPrintJob.start(); 3. Add Target Component to [...]]]></description>
			<content:encoded><![CDATA[<p>The build-in print function provided by Adobe Flex is actually pretty straightforward. For a single page print, it is good enough. Here is how it works:</p>
<p><span id="more-314"></span></p>
<p><span style="color: #ff6600;"><strong>Things You Need</strong></span></p>
<ul>
<li> <strong>mx.printing.FlexPrintJob</strong></li>
</ul>
<p><span style="color: #ff6600;"><strong>Steps You Do</strong></span></p>
<blockquote>
<pre><strong>1. Create a FlexPrintJob Instance</strong><strong>    <span style="color: #0000ff;"> </span></strong><span style="color: #0000ff;">
   var flexPrintJob: FlexPrintJob = new FlexPrintJob();</span>

<strong>2. Start FlexPrintJob
</strong><span style="color: #0000ff;">   flexPrintJob.start();
</span>
<strong>3. Add Target Component to FlexPrintJob </strong><span style="color: #0000ff;">
   printJob.addObject(targetComponent);
</span>
<strong>4. Print
</strong><span style="color: #0000ff;">   printJob.send();</span></pre>
</blockquote>
<p><span style="color: #ff6600;"><strong>Sample Code<br />
</strong></span></p>
<blockquote>
<pre><span style="color: #0000ff;">&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="<span style="color: #993366;">http://www.adobe.com/2006/mxml</span>"
    layout="<span style="color: #993366;">absolute</span>"
    initialize="init()"&gt;

    <span style="color: #008000;">&lt;mx:Script&gt;</span>
    	&lt;![CDATA[
    	import mx.printing.FlexPrintJob;
    	import mx.collections.ArrayCollection;

    	[Bindable]
    	public var dataSource:ArrayCollection = new ArrayCollection();

        private var totalRecords:Number = <span style="color: #993366;">15</span>; 

    	private <span style="color: #008000;">function </span>init():void {
		for (var i:int = 1; i&lt;=</span><span style="color: #0000ff;">totalRecords</span><span style="color: #0000ff;">; i++) {
    		     var dataObject:Object = new Object();
    		     dataObject.Name = "<span style="color: #993366;">Name #</span>" + i;
    		     dataObject.Phone = "<span style="color: #993366;">Phone #</span>" + i;
    		     dataObject.Address = "<span style="color: #993366;">Address #</span>" + i;
    		     dataSource.addItem(dataObject);
    		}
    	}

    	private <span style="color: #008000;">function </span>doPrint():void {
    		var printJob:FlexPrintJob = new FlexPrintJob();
    	   	if (printJob.start()) {
    	            printJob.addObject(myData);
    		    printJob.send();
    		}
    	}

    	]]&gt;
    <span style="color: #008000;">&lt;/mx:Script&gt;</span>

    &lt;mx:Panel title="<span style="color: #993366;">Flex Tutorial - Print</span>"
    	width="<span style="color: #993366;">500</span>" height="<span style="color: #993366;">500</span>"
    	horizontalCenter="<span style="color: #993366;">0</span>" verticalCenter="<span style="color: #993366;">0</span>"
    	horizontalAlign="<span style="color: #993366;">center</span>" verticalAlign="<span style="color: #993366;">middle</span>"&gt;

        &lt;mx:DataGrid id="<span style="color: #993366;">myData</span>"
            dataProvider="<span style="color: #993366;">{</span>dataSource<span style="color: #993366;">}</span>"
            width="<span style="color: #993366;">400</span>" height="<span style="color: #993366;">400</span>" /&gt;

        &lt;mx:Button label="<span style="color: #993366;">Print</span>" click="doPrint()"/&gt;

    &lt;/mx:Panel&gt;

&lt;/mx:Application&gt;
</span></pre>
</blockquote>
<p><span style="color: #ff6600;"><strong>Conclusion</strong></span></p>
<p>Adobe Flex provides FlexPrintJob to handle the print request. It is very simple to use. However, the biggest challenge is printing multiple pages. In the above sample code, if you change the code,</p>
<p>From:</p>
<blockquote>
<pre><span style="color: #0000ff;">private var totalRecords:Number = <span style="color: #993366;"><strong>15</strong></span>;
</span></pre>
</blockquote>
<p>To:</p>
<blockquote>
<pre><span style="color: #0000ff;">private var totalRecords:Number = <span style="color: #993366;"><strong>100</strong></span>;
</span></pre>
</blockquote>
<p>It will generate <strong>100 </strong>records in the DataGrid. Guess how many of them will be printed if you click the Print button?  Depends on your page and printer setting, maybe just 17-20. You will even see a ugly vertical scoll bar. The problem here is, FlexPrintJob itself can not <strong>SCOLL </strong>those Scollable Components like DataGrid or TextArea.</p>
<p>To resolve this problem, Adobe provides a workaround in Flex framework. In the next tutorial, we will see <a title="Printing Multiple Pages Using PrintDataGrid" href="http://flextutorial.org/2009/05/28/printing-multiple-pages-using-printdatagrid/">Printing Multiple Pages Using PrintDataGrid</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://flextutorial.org/2009/05/21/using-flex-build-in-print-function/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Print in Adobe Flex</title>
		<link>http://flextutorial.org/2009/05/21/how-to-print-in-adobe-flex/</link>
		<comments>http://flextutorial.org/2009/05/21/how-to-print-in-adobe-flex/#comments</comments>
		<pubDate>Thu, 21 May 2009 15:37:33 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Flex Print]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[Flex Report]]></category>
		<category><![CDATA[FlexReport]]></category>
		<category><![CDATA[how to print]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[print multiple pages]]></category>
		<category><![CDATA[PrintDataGrid]]></category>
		<category><![CDATA[PrintText]]></category>

		<guid isPermaLink="false">http://flextutorial.org/?p=305</guid>
		<description><![CDATA[Believe it or not, my first Flex job had nothing to do with even 1% of Rich Internet Application. It was to print multiple pages in Flex. I know what you are thinking right now. Why should I care printing in Flex? Is Flex supposed to be used for creating cool stuffs rather than this [...]]]></description>
			<content:encoded><![CDATA[<p>Believe it or not, my first Flex job had nothing to do with even 1% of Rich Internet Application. It was to <strong>print multiple pages in Flex.</strong></p>
<p>I know what you are thinking right now. Why should I care printing in Flex? Is Flex supposed to be used for creating cool stuffs rather than this kind of low-level system function? That was exactly what I thought at that time. But job is job, especially when the pay is good.</p>
<p>The interesting thing is I actually learned a lot from this printing job. Because it touched many key areas of Flex framework, such as: Container Framework, Component Construction, and Layout Management. The fact is, once you know something from inside out, you will feel some fun of doing it.</p>
<p><span id="more-305"></span></p>
<p>Over the next week, I want to write a series of 4 tutorials about How to Print in Flex. Here are the topics we will be covering:</p>
<ol>
<li><a title="Using Flex Build-in Print Function" href="http://flextutorial.org/2009/05/21/using-flex-build-in-print-function/">Using Flex Build-in Print Function</a></li>
<li><a title="Printing Multiple Pages Using PrintDataGrid" href="http://flextutorial.org/2009/05/28/printing-multiple-pages-using-printdatagrid/">Printing Multiple Pages using PrintDataGrid</a></li>
<li><a title="Printing Multiple Pages using FlexReport" href="http://flextutorial.org/2009/06/02/printing-multiple-pages-using-flexreport/">Printing Multiple Pages using FlexReport</a></li>
<li><a title="Understanding Flex Print Job from A to Z" href="http://flextutorial.org/2009/06/23/understanding-flex-print-job-from-a-to-z/">Understanding Flex Print Job from A to Z</a></li>
</ol>
<p>To follow along with this series, make sure you <a href="http://flextutorial.org/feed/">subscribe to our RSS feed</a> or bookmark and come back to this page.</p>
<p>Stay tuned for the next post of this tutorial series on <a title="Using Flex Build-in Print Function" href="http://flextutorial.org/2009/05/21/using-flex-build-in-print-function/"><strong>Using Flex Build-in Print Function</strong></a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://flextutorial.org/2009/05/21/how-to-print-in-adobe-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
