33 Replies Latest reply on Oct 18, 2011 1:42 PM by DilipShah

    PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende

    DilipShah Level 1
      I'm printing a datagrid using something like  this...
      <mx:PrintDataGrid
        id="printDataGrid" 
        width="100%" 
        height="100%"
        showHeaders="false"
        borderVisible="false"
        horizontalGridLines="false"
        variableRowHeight="true"
        dataProvider="{titles}"
        >
        <mx:columns>
         <mx:DataGridColumn 
          itemRenderer="renderer.TitlePrintRenderer" 
          />
        </mx:columns>
      </mx:PrintDataGrid>
      TitlePrintRenderer.mxml has s:RichText component. I use  RichText's textFlow property to render the text. The approach is working fine  except that if the textFlow has embedded images (<img source=... />), the  images are not printed!
      Is this a bug? Is it a limitation? Has anyone come  across this issue?

      I'm using Flex SDK 4.5.1

        • 1. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
          Flex harUI Adobe Employee

          If the images have to be loaded, they won't show up right away.  You will

          need to preload them or find a way to wait.

          • 2. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
            DilipShah Level 1

            Thanks!

            The text is fetched from the database and has urls to the images.
            So, I should
            1. parse the text and create the collection of such urls
            2. create an array of flash.display.Bitmap objects by loading images from the urls
            3. replace all the <img source=url with <img source=bitmap object

            Does this look like a fair approach?

            I couldn't find the syntax for specifying bitmap object as img tag's source?


            • 3. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
              Flex harUI Adobe Employee

              That might work.  I'm not sure you can specify source in

              markup.  I

              think you have to actually create your own InlineGraphicElements and hand

              them the bitmaps.

               

              Another factor is whether the images have already been seen and are in a

              cache somewhere.  If you think they will load quickly, you can probably just

              wait a few frames before calling addObject/addPage.

              • 4. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                DilipShah Level 1
                No success so far in printing images in PrintDataGrid.
                Here is what I've done to implement your  suggestions:
                I modified Adobe's 'standard' multipage print example to  display images in the DataGrid and then print using PrintDataGrid, whose  renderer refers to the same image as the DataGrid's DataGridColumn.
                The image is in the projects assets/images folder and it  does show up on the screen in DataGrid but when you go to print, the text parts  of the PrintDataGrid's renderer are printed but not the images are  not.
                I tried to implement Timer so that I can delay call to  printJob.addObject(thePrintView). In the timer's TimerEvent.TIMER handler  function, I'm calling the printJob.addObject(thePrintView) but then I get the  following runtime error:
                Error: Error #2057: The page could not be added to the  print job.
                at Error$/throwError()
                at  flash.printing::PrintJob/addPage()
                at  mx.printing::FlexPrintJob/addObject()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\p rinting\FlexPrintJob.as:438]
                at  PrintMultiPage/timerHandler()[C:\projects\PrintMultiPage\src\PrintMultiPage.mxml:144]
                at  flash.utils::Timer/_timerDispatch()
                at  flash.utils::Timer/tick()

                Any other way to implement the delay before I invoke  printJob.addObject(thePrintView)?


                • 6. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                  DilipShah Level 1
                  Instead of Timer callback, I now have callLater().  In  the callLater function, I make a call to printJob.addObject() and get similar  error message.

                  Error: Error #2057: The page could not be added to the  print job.
                  at Error$/throwError()
                  at  flash.printing::PrintJob/addPage()
                  at  mx.printing::FlexPrintJob/addObject()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\p rinting\FlexPrintJob.as:438]
                  at  PrintMultiPage/doPrinting()[C:\projects\PrintMultiPage\src\PrintMultiPage.mxml:109]
                  at  Function/http://adobe.com/AS3/2006/builtin::apply()
                  at  mx.core::UIComponent/callLaterDispatcher2()[E:\dev\4.5.1\frameworks\projects\framework\sr c\mx\core\UIComponent.as:12208]
                  at  mx.core::UIComponent/callLaterDispatcher()[E:\dev\4.5.1\frameworks\projects\framework\src \mx\core\UIComponent.as:12146]


                  I've pasted all the code needed to create a simple  project (4 files and one image) to bring out this issue.
                  Once the application is running,
                  1. click on 'Fill Grid' button --> this should  populate 3 rows in the data grid. the first row displays srNo and the second one  displays an image of a simple formula
                  2. click on Print button --> this will throw the  error mentioned above

                  Instead of calling printJob.addObject() in callLater  function, if it's called in the main function itself (currently commented out),  the printout is generated but without the images

                  PrintImagesTest.mxml
                  =================
                  <?xml version="1.0"?>
                  <!-- printing\MultiPagePrint.mxml -->
                  <s:Application
                      xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      initialize="initData();"
                      >
                      <!-- The form that appears on the user's system.-->
                      <mx:Form id="myForm" width="80%">
                          <mx:FormHeading label="Titles"/>
                          <mx:DataGrid id="myDataGrid" dataProvider="{dgProvider}">
                              <mx:columns>
                                  <mx:DataGridColumn
                                      dataField="srNo"
                                      />
                                  <mx:DataGridColumn>
                                      <mx:itemRenderer>
                                          <fx:Component>
                                              <mx:Image height="49" source="assets/images/formula.gif"/>
                                          </fx:Component>
                                      </mx:itemRenderer>
                                  </mx:DataGridColumn>
                              </mx:columns>
                          </mx:DataGrid>
                         
                          <mx:HBox>
                              <mx:Button
                                  id="setDP"
                                  label="Fill Grid"
                                  click="setdgProvider();"
                                  />
                              <mx:Button
                                  id="printDG"
                                  label="Print"
                                  click="doPrint();"/>
                          </mx:HBox>
                      </mx:Form>
                     
                      <fx:Script>
                          <![CDATA[
                              import mx.collections.ArrayCollection;
                              import mx.controls.Alert;
                              import mx.printing.*;
                             
                              import myComponents.FormPrintView;
                             
                              import vo.TitleVO;
                             
                              [Bindable]
                              public var dgProvider:ArrayCollection;
                              public var dgProviderPrint:ArrayCollection;
                              public var footerHeight:Number = 20;
                              public var prodIndex:Number;
                              public var prodTotal:Number = 0;
                             
                              public var printJob:FlexPrintJob;
                              public var thePrintView:FormPrintView;
                             
                              // Data initialization, called when the application initializes
                              public function initData():void {
                                  // Create the data provider for the DataGrid control.
                                  dgProvider = new ArrayCollection();
                                  dgProviderPrint = new ArrayCollection();
                              }
                             
                              // Fill the dgProvider ArrayCollection with the specified items
                              public function setdgProvider():void {
                                  dgProvider.removeAll();
                                  dgProviderPrint.removeAll();
                                 
                                  for (var z:int=0; z<3; z++)    {
                                      var row:Object = new Object();
                                      row.srNo = z+1;
                                      var title:TitleVO = new TitleVO();
                                      title.titleText =
                                          "<TextFlow columnCount='inherit' columnGap='inherit' columnWidth='inherit' lineBreak='inherit' paddingBottom='inherit' paddingLeft='inherit' paddingRight='inherit' paddingTop='inherit' verticalAlign='inherit' whiteSpaceCollapse='preserve' xmlns='http://ns.adobe.com/textLayout/2008'><p><span>harry potter and the sorcerer's stone</span></p>" +
                                          "<p><span><img width='53' height='49' source='assets/images/formula.gif'/></span></p>" +
                                          "<p><span>(July, 2008)</span></p>" +
                                          "</TextFlow>";
                                      dgProvider.addItem(row);
                                      dgProviderPrint.addItem(title);
                                  }
                              }
                             
                              // The function to print the output.
                              public function doPrint():void {
                                  printJob = new FlexPrintJob();

                   

                                  if (printJob.start()) {
                                      thePrintView = new FormPrintView();
                                      addElement(thePrintView);

                   

                                      thePrintView.width=printJob.pageWidth;
                                      thePrintView.height=printJob.pageHeight;

                   

                                      thePrintView.myDataGrid.dataProvider = dgProviderPrint;
                                      //printJob.addObject(thePrintView);
                                      callLater(doPrinting);

                   

                                      removeElement(thePrintView);
                                  }
                                  // Send the job to the printer.
                                  printJob.send();
                              }
                             
                              
                              private function doPrinting():void {
                                  printJob.addObject(thePrintView);
                              }
                             
                          ]]>
                      </fx:Script>
                  </s:Application>

                  myComponents/FormPrintView.mxml

                  ===========================

                  <?xml version="1.0"?>
                  <!-- printing\myComponents\FormPrintView.mxml -->
                  <mx:VBox
                      xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      xmlns:MyComp="myComponents.*"
                      backgroundColor="#FFFFFF"
                      paddingTop="50" paddingBottom="50" paddingLeft="50"
                      >
                      <fx:Script>
                          <![CDATA[
                              import mx.core.*
                                 
                                  public function showPage(pageType:String):void {
                                      //Update the DataGrid layout to reflect the results.
                                      validateNow();
                                  }
                          ]]>
                      </fx:Script>
                     
                      <!-- The sizeToPage property is true by default, so the last
                      page has only as many grid rows as are needed for the data. -->
                      <mx:PrintDataGrid
                          id="myDataGrid"
                          width="60%"
                          height="100%"
                          showHeaders="false"
                          borderVisible="false"
                          horizontalGridLines="false"
                          variableRowHeight="true"
                          >
                          <!-- Specify the columns to ensure that their order is correct. -->
                          <mx:columns>
                              <mx:DataGridColumn
                                  itemRenderer="renderer.MyPrintRenderer"
                                  />
                          </mx:columns>
                      </mx:PrintDataGrid>
                  </mx:VBox>

                   

                   

                  renderer/MyPrintRenderer.mxml

                  =======================

                  <?xml version="1.0" encoding="utf-8"?>
                  <s:MXDataGridItemRenderer
                      xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      xmlns:bslns="com.knownomy.bsl.view.component.*"
                      >
                      <s:layout>
                          <s:VerticalLayout
                              paddingLeft="5"
                              paddingRight="5"
                              paddingTop="3"
                              paddingBottom="3"
                              gap="5"
                              horizontalAlign="left"
                              clipAndEnableScrolling="true"
                              />
                      </s:layout>
                     
                      <fx:Declarations>
                      </fx:Declarations>
                     
                      <s:HGroup
                          width="100%"
                          gap="5"
                          verticalAlign="middle"
                          >
                          <s:RichText
                              id="title"
                              width="700"
                              textFlow="{myTextFlow}"
                              color="0x000000"
                              fontFamily="Verdana"
                              fontSize="10"
                              />
                      </s:HGroup>
                     
                      <fx:Metadata>
                      </fx:Metadata>
                     
                      <s:states>
                          <s:State name="normal" />
                          <s:State name="hovered" />
                          <s:State name="selected" />
                      </s:states>
                     
                      <fx:Script>
                          <![CDATA[
                              import vo.TitleVO;
                             
                              import flashx.textLayout.conversion.TextConverter;
                              import flashx.textLayout.elements.TextFlow;
                             
                              import mx.controls.Alert;
                              import mx.core.FlexGlobals;
                              import mx.events.CloseEvent;
                             
                              import spark.utils.TextFlowUtil;
                             
                              [Bindable]
                              private var myTextFlow:TextFlow;
                             
                              override public function set data(value:Object) : void {
                                  if (value != null) {
                                      super.data = value;
                                     
                                      // generate textflows from the text
                                      myTextFlow =
                                          TextConverter.importToFlow(
                                              data.titleText,
                                              TextConverter.TEXT_LAYOUT_FORMAT
                                          );
                                  }
                              }
                          ]]>
                      </fx:Script>
                  </s:MXDataGridItemRenderer>

                   

                   

                  vo/TitleVO.as

                  ==========

                  package vo
                  {
                      /**
                       * Value Object class for Title.
                       *
                       *
                       */
                      [Bindable]
                      public class TitleVO {
                          public var titleText:String;
                      }
                  }

                   

                   

                  assets/images/formula.gif:

                  ===================

                  formula.gif

                  • 8. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                    DilipShah Level 1

                    I've spent quite a bit of time on this but am still unable to fix this issue. Please help!

                     

                    I've trim down the test / sample application's code to bare minimum and hosted 2 different versions of the test app on my server. I've enabled View Source.

                    When the application comes up, just click on Print button to print the 3 rows you see on the screen.

                     

                     

                    http://208.109.190.155:9080/printImagesError/PrintImages.htmlThis version does printJob.addObject(thePrintView) in callLater.

                    It throws the following error:

                    Error: Error #2057: The page could not be added to the print job.
                    at Error$/throwError()
                    at flash.printing::PrintJob/addPage()
                    at mx.printing::FlexPrintJob/addObject()
                    at PrintImages/doPrinting()
                    at Function/http://adobe.com/AS3/2006/builtin::apply()
                    at mx.core::UIComponent/callLaterDispatcher2()
                    at mx.core::UIComponent/callLaterDispatcher()

                     

                    http://208.109.190.155:9080/printImagesNotPrinting/PrintImages.htmlThis version does printJob.addObject(thePrintView) when printJob.start() is true.

                    It prints the text that we see on the screen but not the images.

                    • 9. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                      Flex harUI Adobe Employee

                      I was unable to access the link.  Is that IP address public and fixed?

                      • 10. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                        DilipShah Level 1

                        It's a public and fixed IP address. Is it possible that Adobe's firewall policy prevents accessing IP-based url? I've had that experience in the past. If that's the case, I can copy-paste the 3 program files here. Let me know.

                        • 11. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                          Flex harUI Adobe Employee

                          Not sure what our firewall rules are.  Anyway, below is a quick test case I put together.  I can submit the job later by pressing the submit button (within 15 seconds of starting the job).  See if this test case works for you.

                           

                          <?xml version="1.0" encoding="utf-8"?>

                          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                                         xmlns:s="library://ns.adobe.com/flex/spark"

                                         xmlns:mx="library://ns.adobe.com/flex/mx"

                                         xmlns:comps="comps.*"

                                         >

                             <!<fx:Style source="Accessibility.css" />>

                           

                              <s:layout>

                                 <s:VerticalLayout paddingLeft="20" paddingRight="20"

                                                    paddingTop="20" paddingBottom="20" />

                             </s:layout>

                             <s:controlBarContent>

                                 <s:Label id="sdkVer" initialize="sdkVer.text = mx_internal::VERSION;" />

                             </s:controlBarContent>

                           

                              <fx:Script>

                                 <![CDATA[

                                      import mx.printing.FlexPrintJob;

                           

                                      private var pj:FlexPrintJob;

                           

                                      private function printIt():void

                                     {

                                          pj = new FlexPrintJob();

                                          if (pj.start())

                                          {

                                              swfldr.source = "umbrellas.jpg";

                                          }

                           

                                      }

                           

                                      private function imageComplete():void

                                     {

                                          submit.visible = true;

                                      }

                           

                                      private function submitJob():void

                                     {

                                          pj.addObject(pnl);

                                          pj.send();

                                      }

                           

                                  ]]>

                              </fx:Script>

                             <s:Panel id="pnl" title="Print in Background Test"

                                       width="75%" height="100%"

                                       horizontalCenter="0" verticalCenter="0">

                                 <s:VGroup left="10" right="10" top="10" bottom="10">

                                     <s:Label width="100%" color="blue"

                                               text="Background Print Job Test"/>

                                     <s:Button label="foo" click="printIt()"/>

                                     <s:Button id="submit" label="submit" click="submitJob()" visible="false"/>

                                     <s:List id="list">

                                         <s:dataProvider>

                                             <s:ArrayList source="[1, 2, 3, 4]" />

                                         </s:dataProvider>

                                     </s:List>

                                     <mx:SWFLoader id="swfldr" complete="imageComplete()" />

                                 </s:VGroup>

                             </s:Panel>

                          </s:Application

                          1 person found this helpful
                          • 12. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                            DilipShah Level 1

                            Thanks... the test case worked for me! I can print the panel with the image.

                            Let me try to implement this approach in my application where I have a DataGroup and the DataGroup's renderer has RichText. I'll need to figure out how to determine when images in the RichText's textFlow are loaded.

                            • 13. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                              DilipShah Level 1

                              I could successfully implement your approach in my sample but now I'm struggling to implement it in my main application that requires multipage printing involving PrintDataGrid control.

                               

                              In multipage printing, you check if the printDataGrid has validNextPage and if so call nextPage method on it, do validateNow and add it to the print job.

                               

                              Since adding to the print job is a manual process (upon button click), the user will have to click on the button to add each page to the print job that has already started? I implemented timer and adding to the print job in the TimerEvent.TIMER event handler. This approach actually sends the page to the printer but also throws Error: Error #2057: The page could not be added to the print job.

                               

                              Any suggestions on how to make the approach work in multipage printing situation?

                               

                              Thanks a lot


                              • 14. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                Flex harUI Adobe Employee

                                Here’s a version that uses a timer instead of a button and submits two pages.

                                 

                                <?xml version="1.0" encoding="utf-8"?>
                                <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                                               xmlns:s="library://ns.adobe.com/flex/spark"
                                               xmlns:mx="library://ns.adobe.com/flex/mx"
                                               xmlns:comps="comps.*"
                                               >
                                   <!--<fx:Style source="Accessibility.css" />-->
                                
                                    <s:layout>
                                       <s:VerticalLayout paddingLeft="20" paddingRight="20"
                                                          paddingTop="20" paddingBottom="20"></s:VerticalLayout>
                                   </s:layout>
                                   <s:controlBarContent>
                                       <s:Label id="sdkVer" initialize="sdkVer.text = mx_internal::VERSION;"></s:Label>
                                   </s:controlBarContent>
                                
                                    <fx:Script>
                                       <![CDATA[
                                            import mx.printing.FlexPrintJob;
                                
                                            private var pj:FlexPrintJob;
                                
                                            private function printIt():void
                                           {
                                                pj = new FlexPrintJob();
                                                if (pj.start())
                                                {
                                                    swfldr.source = "umbrellas.jpg";
                                                }
                                
                                            }
                                
                                            private function imageComplete():void
                                           {
                                                setTimeout(submitPage1, 2000);
                                            }
                                
                                            private function submitPage1():void
                                           {
                                                pj.addObject(pnl);
                                                lbl.text = "This is page 2";
                                                setTimeout(submitPage2, 2000);
                                            }
                                
                                            private function submitPage2():void
                                           {
                                                pj.addObject(pnl);
                                                pj.send();
                                            }
                                
                                        \]\]\>
                                    </fx:Script>
                                   <s:Panel id="pnl" title="Print in Background Test"
                                             width="75%" height="100%"
                                             horizontalCenter="0" verticalCenter="0">
                                       <s:VGroup left="10" right="10" top="10" bottom="10">
                                           <s:Label id="lbl" width="100%" color="blue"
                                                     text="Background Print Job Test"></s:Label>
                                           <s:Button label="foo" click="printIt()"></s:Button>
                                           <s:List id="list">
                                               <s:dataProvider>
                                                   <s:ArrayList source="[1, 2, 3, 4]"></s:ArrayList>
                                               </s:dataProvider>
                                           </s:List>
                                           <mx:SWFLoader id="swfldr" complete="imageComplete()"></mx:SWFLoader>
                                       </s:VGroup>
                                   </s:Panel>
                                </s:Application>
                                

                                 

                                • 15. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                  DilipShah Level 1

                                  Thank you very much... the suggestion really helped me and I'm very close to finally solving it!

                                   

                                  I took your approach and implemented in my test case that has PrintDataGrid with variable number of rows. The test case application prints all the pages except for the last one and on statement printJob.addObject(thePrintView); for the last page, throws the following error:

                                   

                                  You can compare the sr no on the screen and the printout to confirm that the last page is not printed.

                                  Error: Error #2057: The page could not be added to the print job.
                                  at Error$/throwError()
                                  at flash.printing::PrintJob/addPage()
                                  at mx.printing::FlexPrintJob/addObject()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\p rinting\FlexPrintJob.as:438]
                                  at PrintImages/doPrintMultiple()[C:\projects\PrintImages\src\PrintImages.mxml:108]
                                  at Function/http://adobe.com/AS3/2006/builtin::apply()
                                  at SetIntervalTimer/onTimer()
                                  at flash.utils::Timer/_timerDispatch()
                                  at flash.utils::Timer/tick()

                                  I'm pasted the test case code below that will allow you to recreate this error condition.

                                   

                                  Could you please try out the test case and let me know if there is issue with the way I'm implementing it or it's a Flex bug?

                                   

                                  PrintImages.mxml

                                  =================

                                  <?xml version="1.0" encoding="utf-8"?>

                                  <s:Application

                                      xmlns:fx="http://ns.adobe.com/mxml/2009"

                                      xmlns:s="library://ns.adobe.com/flex/spark"

                                      xmlns:mx="library://ns.adobe.com/flex/mx"

                                      minWidth="955" minHeight="600"

                                      initialize="initData();"

                                      viewSourceURL="srcview/index.html"

                                      >

                                      <s:layout>

                                          <s:VerticalLayout

                                              paddingLeft="20" paddingRight="20"

                                              paddingTop="20" paddingBottom="20"

                                              />

                                      </s:layout>

                                     

                                      <fx:Declarations>

                                      </fx:Declarations>

                                      <mx:DataGrid id="myDataGrid" dataProvider="{dgProvider}">

                                          <mx:columns>

                                              <mx:DataGridColumn

                                                  dataField="srNo"

                                                  />

                                              <mx:DataGridColumn>

                                                  <mx:itemRenderer>

                                                      <fx:Component>

                                                          <mx:Image height="49" source="assets/images/formula.gif"/>

                                                      </fx:Component>

                                                  </mx:itemRenderer>

                                              </mx:DataGridColumn>

                                          </mx:columns>

                                      </mx:DataGrid>

                                     

                                      <mx:Button

                                          id="startDG"

                                          label="Start"

                                          click="doStart();"

                                          />

                                   

                                      <fx:Script>

                                          <![CDATA[

                                              import flash.utils.setTimeout;

                                             

                                              import mx.collections.ArrayCollection;

                                              import mx.printing.*;

                                              import mx.utils.OnDemandEventDispatcher;

                                             

                                              [Bindable]

                                              public var dgProvider:ArrayCollection;

                                              public var dgProviderPrint:ArrayCollection;

                                             

                                              public var printJob:FlexPrintJob;

                                              public var thePrintView:FormPrintView;

                                             

                                              public var timer:Timer = new Timer(5000);

                                             

                                              public var lastPage:Boolean;

                                             

                                              public function initData():void {

                                                  dgProvider = new ArrayCollection();

                                                  dgProviderPrint = new ArrayCollection();

                                                 

                                                  for (var z:int=0; z<25; z++)    {

                                                      var row:Object = new Object();

                                                      row.srNo = z+1;

                                                      var title:Object = new Object();

                                                      title.srNo = z+1;

                                                      title.titleText =

                                                          "<TextFlow whiteSpaceCollapse='preserve' xmlns='http://ns.adobe.com/textLayout/2008'>" +

                                                          "<img width='53' height='49' source='assets/images/formula.gif'/>" +

                                                          "</TextFlow>";

                                                      dgProvider.addItem(row);

                                                      dgProviderPrint.addItem(title);

                                                  }

                                              }

                                             

                                              public function doStart():void {

                                                  printJob = new FlexPrintJob();

                                                  lastPage = false;

                                                 

                                                  if (printJob.start()) {

                                                      thePrintView = new FormPrintView();

                                                      addElement(thePrintView);

                                                     

                                                      thePrintView.width=printJob.pageWidth;

                                                      thePrintView.height=printJob.pageHeight;

                                                     

                                                      thePrintView.printDataGrid.dataProvider = dgProviderPrint;

                                                      thePrintView.showPage("single");

                                                     

                                                      if(!thePrintView.printDataGrid.validNextPage) {

                                                          setTimeout(doPrintSingle, 1000);

                                                      } else {

                                                          thePrintView.showPage("first");

                                                          setTimeout(doPrintMultiple, 1000);

                                                      }

                                                  }

                                              }

                                             

                                              public function doPrintSingle():void {

                                                  printJob.addObject(thePrintView);

                                                  removeElement(thePrintView);

                                                  printJob.send();

                                              }

                                             

                                             

                                              public function doPrintMultiple():void {

                                                  printJob.addObject(thePrintView);

                                                 

                                                  thePrintView.printDataGrid.nextPage();

                                                 

                                                  thePrintView.showPage("last"); 

                                                 

                                                  if(!thePrintView.printDataGrid.validNextPage) {

                                                      setTimeout(doPrintMultiple, 1000);

                                                      lastPage = true;

                                                  } else {

                                                      thePrintView.showPage("middle");

                                                      setTimeout(doPrintMultiple, 1000);

                                                  }

                                                 

                                                  if (lastPage) {

                                                      removeElement(thePrintView);

                                                      printJob.send();

                                                  }

                                              }

                                             

                                          ]]>

                                      </fx:Script>

                                  </s:Application>

                                   

                                   

                                  FormPrintView.mxml

                                  ===============

                                  <?xml version="1.0"?>

                                  <mx:VBox

                                      xmlns:fx="http://ns.adobe.com/mxml/2009"

                                      xmlns:s="library://ns.adobe.com/flex/spark"

                                      xmlns:mx="library://ns.adobe.com/flex/mx"

                                      xmlns:MyComp="myComponents.*"

                                      backgroundColor="#FFFFFF"

                                      paddingTop="50" paddingBottom="50" paddingLeft="50"

                                      >

                                      <fx:Script>

                                          <![CDATA[

                                              import mx.core.*

                                                 

                                                  public function showPage(pageType:String):void {

                                                      validateNow();

                                                  }

                                          ]]>

                                      </fx:Script>

                                     

                                      <mx:PrintDataGrid

                                          id="printDataGrid"

                                          width="60%"

                                          height="100%"

                                          showHeaders="false"

                                          borderVisible="false"

                                          horizontalGridLines="false"

                                          variableRowHeight="true"

                                          >

                                          <mx:columns>

                                              <mx:DataGridColumn

                                                  itemRenderer="MyPrintRenderer"

                                                  />

                                          </mx:columns>

                                      </mx:PrintDataGrid>

                                  </mx:VBox>

                                   

                                   

                                  MyPrintRenderer.mxml

                                  =================

                                  <?xml version="1.0" encoding="utf-8"?>

                                  <s:MXDataGridItemRenderer

                                      xmlns:fx="http://ns.adobe.com/mxml/2009"

                                      xmlns:s="library://ns.adobe.com/flex/spark"

                                      xmlns:mx="library://ns.adobe.com/flex/mx"

                                      xmlns:bslns="com.knownomy.bsl.view.component.*"

                                      >

                                      <s:layout>

                                          <s:VerticalLayout

                                              paddingLeft="5"

                                              paddingRight="5"

                                              paddingTop="3"

                                              paddingBottom="3"

                                              gap="5"

                                              horizontalAlign="left"

                                              clipAndEnableScrolling="true"

                                              />

                                      </s:layout>

                                     

                                      <fx:Declarations>

                                      </fx:Declarations>

                                     

                                      <s:HGroup

                                          width="100%"

                                          gap="5"

                                          verticalAlign="middle"

                                          >

                                          <s:Label

                                              text="{data.srNo}"

                                              color="0x000000"

                                              fontFamily="Verdana"

                                              fontSize="10"

                                              />

                                          <s:RichText

                                              id="title"

                                              width="700"

                                              textFlow="{myTextFlow}"

                                              color="0x000000"

                                              fontFamily="Verdana"

                                              fontSize="10"

                                              />

                                      </s:HGroup>

                                     

                                      <fx:Metadata>

                                      </fx:Metadata>

                                     

                                      <s:states>

                                          <s:State name="normal" />

                                          <s:State name="hovered" />

                                          <s:State name="selected" />

                                      </s:states>

                                     

                                      <fx:Script>

                                          <![CDATA[

                                              import flashx.textLayout.conversion.TextConverter;

                                              import flashx.textLayout.elements.TextFlow;

                                             

                                              import mx.controls.Alert;

                                              import mx.core.FlexGlobals;

                                              import mx.events.CloseEvent;

                                             

                                              import spark.utils.TextFlowUtil;

                                             

                                              [Bindable]

                                              private var myTextFlow:TextFlow;

                                             

                                              override public function set data(value:Object) : void {

                                                  if (value != null) {

                                                      super.data = value;

                                                     

                                                      // generate textflows from the text

                                                      myTextFlow =

                                                          TextConverter.importToFlow(

                                                              data.titleText,

                                                              TextConverter.TEXT_LAYOUT_FORMAT

                                                          );

                                                  }

                                              }

                                          ]]>

                                      </fx:Script>

                                  </s:MXDataGridItemRenderer>

                                  • 16. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                    Flex harUI Adobe Employee

                                    The documentation states that you have to get a page added every 15 seconds.

                                     

                                    I would not recommend using setTimeout in a production application.  You want to use events.

                                    • 17. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                      DilipShah Level 1

                                      I tested the code with 15 second timeout and it still throws the same error.

                                       

                                      If I were to use events instead of setTimeout, what events can I use? The images are loaded via RichText's textFlow that's in PrintDataGrid's renderer. Also, since PrintDataGrid has variable number of rows, I wouldn't know how many row (renderers) are there in a page being printed!

                                      • 18. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                        Flex harUI Adobe Employee

                                        I’m not sure what your first sentence meant.  If you take over 15 seconds, you will get such an error.  The question is whether the last page is taking more than 15 seconds from the prior page.

                                         

                                        I believe there are events from the TextFlow elements when images load.

                                        • 19. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                          DilipShah Level 1

                                          After struggling for 4+ days on using timer / events for printing PrintDataGrid with embedded images in RichText's textFlow, I tried your other suggestion... to convert <img> tags to InlineGraphicElement and give it Bitmap from image loaded from a .gif file. The approach works but the printout skips images in a few rows!

                                           

                                          I've this test case in which, every time I print, it skips printing image in the second row! I also implemented this approach in a more complex test case and depending on the total number of rows, it would skip printing image in different number of rows. I'm suspecting that even if you construct InlineGraphicElement from bitmap loaded from an image, PrintDataGrid's renderer still skips printing image intermittently.

                                           

                                          I would very much appreciate it if you could create small project from my following code and verify this behavior. I'm at my wit's end in getting this printing to work.

                                           

                                          PrintImagesTest.mxml

                                          =================

                                          <?xml version="1.0" encoding="utf-8"?>

                                          <s:Application

                                              xmlns:fx="http://ns.adobe.com/mxml/2009"

                                              xmlns:s="library://ns.adobe.com/flex/spark"

                                              xmlns:mx="library://ns.adobe.com/flex/mx"

                                              minWidth="955" minHeight="600"

                                              initialize="initData();"

                                              viewSourceURL="srcview/index.html"

                                              >

                                              <s:layout>

                                                  <s:VerticalLayout

                                                      paddingLeft="20" paddingRight="20"

                                                      paddingTop="20" paddingBottom="20"

                                                      />

                                              </s:layout>

                                             

                                              <mx:Button

                                                  label="Print"

                                                  click="printClickHandler();"

                                                  />

                                             

                                              <fx:Script>

                                                  <![CDATA[

                                                      import flash.utils.setTimeout;

                                                     

                                                      import flashx.textLayout.elements.InlineGraphicElement;

                                                      import flashx.textLayout.elements.ParagraphElement;

                                                      import flashx.textLayout.elements.SpanElement;

                                                      import flashx.textLayout.elements.TextFlow;

                                                     

                                                      import mx.collections.ArrayCollection;

                                                      import mx.printing.*;

                                                      import mx.utils.OnDemandEventDispatcher;

                                                     

                                                      public var contentData:ArrayCollection;

                                                      private var embeddedImages:ArrayCollection;

                                                      private var numberOfImagesLoaded:int;

                                                     

                                                      public var printJob:FlexPrintJob;

                                                      public var thePrintView:FormPrintView;

                                                     

                                                      public var lastPage:Boolean;

                                                     

                                                      private var textFlowNS:Namespace = new Namespace("http://ns.adobe.com/textLayout/2008");

                                                     

                                                      public function initData():void {

                                                          contentData = new ArrayCollection();

                                                         

                                                          var page:int = 0;

                                                          for (var z:int=0; z<20; z++)    {

                                                              var content:Object = new Object();

                                                              content.srNo = z+1;

                                                              content.contentText =

                                                              "<TextFlow whiteSpaceCollapse='preserve' xmlns='http://ns.adobe.com/textLayout/2008'>" +

                                                              "<span>some text</span>" +

                                                              "<img width='53' height='49' source='assets/images/formula.gif'/>" +

                                                              "</TextFlow>";

                                                             

                                                              contentData.addItem(content);

                                                          }

                                                      }

                                                     

                                                      public function printClickHandler():void {

                                                          convertToTextFlow();

                                                      }

                                                     

                                                      private function convertToTextFlow():void {

                                                          embeddedImages = new ArrayCollection();

                                                          numberOfImagesLoaded = 0;

                                                         

                                                          for each (var contentElement:Object in contentData) {

                                                              extractImageInfo(contentElement.contentText);

                                                          }

                                                         

                                                          if (embeddedImages.length > 0) {

                                                              loadImage(embeddedImages.getItemAt(0).source);

                                                          } else {

                                                              printData();

                                                          }

                                                      }

                                                     

                                                     

                                                      private function extractImageInfo(contentText:String):void {

                                                          var textXml:XML = new XML(contentText);

                                                          var imageList:XMLList = textXml.textFlowNS::img;

                                                          for each (var img:XML in imageList) {

                                                              var embeddedImage:Object = new Object();

                                                              embeddedImage.source = String(img.@source);

                                                              embeddedImage.width = parseInt(img.@width);

                                                              embeddedImage.height = parseInt(img.@height);

                                                             

                                                              embeddedImages.addItem(embeddedImage);

                                                          }

                                                      }

                                                     

                                                     

                                                      private function loadImage(imageSource:String):void {

                                                          var loader:Loader = new Loader();

                                                          var urlRequest:URLRequest = new URLRequest(imageSource);

                                                          loader.load(urlRequest);

                                                          loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);

                                                      }

                                                     

                                                     

                                                      private function imageLoaded(e:Event):void {

                                                          embeddedImages.getItemAt(numberOfImagesLoaded).bitmap = (Bitmap)(e.target.content);

                                                          embeddedImages.getItemAt(numberOfImagesLoaded).width = ((Bitmap)(e.target.content)).width;

                                                          embeddedImages.getItemAt(numberOfImagesLoaded).height = ((Bitmap)(e.target.content)).height;

                                                         

                                                          ++numberOfImagesLoaded;

                                                         

                                                          if (numberOfImagesLoaded < embeddedImages.length) {

                                                              loadImage(embeddedImages.getItemAt(numberOfImagesLoaded).source);

                                                          } else {

                                                              // all the images have been loaded... convert to textflow

                                                              buildContent();

                                                             

                                                              printData();

                                                             

                                                          }

                                                      }

                                                     

                                                     

                                                      private function buildContent():void {

                                                          var contentIndex:int = 0;

                                                          for each (var contentElement:Object in contentData) {

                                                              if (hasImage(contentElement.contentText)) {

                                                                  buildTextFlow(contentElement, contentIndex);

                                                                  ++contentIndex;

                                                              }

                                                          }

                                                      }

                                                     

                                                     

                                                      private function buildTextFlow(content:Object, contentIndex:int):void {

                                                          var textXml:XML = new XML(content.contentText);

                                                          var p:ParagraphElement = new ParagraphElement();

                                                         

                                                          for each(var child:XML in textXml.children()) {

                                                              switch (child.localName()) {

                                                                  case "span":

                                                                      var span:SpanElement;

                                                                      span = new SpanElement();

                                                                      span.text = child;

                                                                      span.fontSize = 10;

                                                                      p.addChild(span);

                                                                      break;

                                                                  case "img":

                                                                      var image:InlineGraphicElement;

                                                                      image = new InlineGraphicElement();

                                                                      image.source = embeddedImages.getItemAt(contentIndex).bitmap;

                                                                      image.width = embeddedImages.getItemAt(contentIndex).width;

                                                                      image.height = embeddedImages.getItemAt(contentIndex).height;

                                                                      p.addChild(image);

                                                                      break;

                                                              }

                                                             

                                                          }

                                                         

                                                          content.textFlow = new TextFlow();

                                                          content.textFlow.addChild(p);

                                                      }

                                                     

                                                     

                                                      private function hasImage(contentText:String):Boolean {

                                                          var textXml:XML = new XML(contentText);

                                                          var imageList:XMLList = textXml.textFlowNS::img;

                                                          if (imageList.length() > 0) {

                                                              return true;

                                                          } else {

                                                              return false;

                                                          }

                                                      }

                                                     

                                                     

                                                      private function printData():void {

                                                          printJob = new FlexPrintJob();

                                                          lastPage = false;

                                                         

                                                          if (printJob.start()) {

                                                              thePrintView = new FormPrintView();

                                                              addElement(thePrintView);

                                                             

                                                              thePrintView.width=printJob.pageWidth;

                                                              thePrintView.height=printJob.pageHeight;

                                                             

                                                              thePrintView.printDataGrid.dataProvider = contentData;

                                                              thePrintView.showPage("single");

                                                             

                                                              if(!thePrintView.printDataGrid.validNextPage) {

                                                                  printJob.addObject(thePrintView);

                                                              } else {

                                                                  thePrintView.showPage("first");

                                                                  printJob.addObject(thePrintView);

                                                                 

                                                                  while (true) {

                                                                      thePrintView.printDataGrid.nextPage();

                                                                     

                                                                      thePrintView.showPage("last"); 

                                                                     

                                                                      if(!thePrintView.printDataGrid.validNextPage) {

                                                                          printJob.addObject(thePrintView);

                                                                          break;

                                                                      } else {

                                                                          thePrintView.showPage("middle");

                                                                          printJob.addObject(thePrintView);

                                                                      }

                                                                  }

                                                              }

                                                             

                                                              removeElement(thePrintView);

                                                          }

                                                          printJob.send();

                                                      }

                                                  ]]>

                                              </fx:Script>

                                          </s:Application>

                                           

                                           

                                          FormPrintView.mxml

                                          ===============

                                          <?xml version="1.0"?>

                                          <mx:VBox

                                              xmlns:fx="http://ns.adobe.com/mxml/2009"

                                              xmlns:s="library://ns.adobe.com/flex/spark"

                                              xmlns:mx="library://ns.adobe.com/flex/mx"

                                              xmlns:MyComp="myComponents.*"

                                              backgroundColor="#FFFFFF"

                                              paddingTop="50" paddingBottom="50" paddingLeft="50"

                                              >

                                              <fx:Script>

                                                  <![CDATA[

                                                      import mx.core.*

                                                         

                                                          public function showPage(pageType:String):void {

                                                              validateNow();

                                                          }

                                                  ]]>

                                              </fx:Script>

                                             

                                              <mx:PrintDataGrid

                                                  id="printDataGrid"

                                                  width="60%"

                                                  height="100%"

                                                  showHeaders="false"

                                                  borderVisible="false"

                                                  horizontalGridLines="false"

                                                  variableRowHeight="true"

                                                  >

                                                  <mx:columns>

                                                      <mx:DataGridColumn

                                                          itemRenderer="MyPrintRenderer"

                                                          />

                                                  </mx:columns>

                                              </mx:PrintDataGrid>

                                          </mx:VBox>

                                           

                                           

                                          MyPrintRenderer.mxml

                                          =================

                                          <?xml version="1.0" encoding="utf-8"?>

                                          <s:MXDataGridItemRenderer

                                              xmlns:fx="http://ns.adobe.com/mxml/2009"

                                              xmlns:s="library://ns.adobe.com/flex/spark"

                                              xmlns:mx="library://ns.adobe.com/flex/mx"

                                              xmlns:bslns="com.knownomy.bsl.view.component.*"

                                              >

                                              <s:layout>

                                                  <s:VerticalLayout

                                                      paddingLeft="5"

                                                      paddingRight="5"

                                                      paddingTop="3"

                                                      paddingBottom="3"

                                                      gap="5"

                                                      horizontalAlign="left"

                                                      clipAndEnableScrolling="true"

                                                      />

                                              </s:layout>

                                             

                                              <fx:Declarations>

                                              </fx:Declarations>

                                             

                                              <s:HGroup

                                                  width="100%"

                                                  gap="5"

                                                  verticalAlign="middle"

                                                  >

                                                  <s:Label

                                                      text="{data.srNo}"

                                                      color="0x000000"

                                                      fontFamily="Verdana"

                                                      fontSize="10"

                                                      />

                                                  <s:RichText

                                                      id="title"

                                                      width="700"

                                                      textFlow="{myTextFlow}"

                                                      color="0x000000"

                                                      fontFamily="Verdana"

                                                      fontSize="10"

                                                      />

                                              </s:HGroup>

                                             

                                              <fx:Metadata>

                                              </fx:Metadata>

                                             

                                              <s:states>

                                                  <s:State name="normal" />

                                                  <s:State name="hovered" />

                                                  <s:State name="selected" />

                                              </s:states>

                                             

                                              <fx:Script>

                                                  <![CDATA[

                                                      import flashx.textLayout.elements.TextFlow;

                                                      [Bindable]

                                                      private var myTextFlow:TextFlow;

                                                     

                                                      override public function set data(value:Object) : void {

                                                          if (value != null) {

                                                              super.data = value;

                                                             

                                                              myTextFlow = data.textFlow;

                                                          }

                                                      }

                                           

                                                  ]]>

                                              </fx:Script>

                                          </s:MXDataGridItemRenderer>

                                          • 20. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                            DilipShah Level 1

                                            I've hosted this test case on my server and since it's a domian based URL, I'm hoping that you'll be able to view the application.

                                            http://www.blueskylearning.com/printImages/PrintImagesTest.html

                                             

                                            When I access the URL and click on Print button, it prints 2 pages and on each page, it skips image in row 2.

                                             

                                            I've turned View Source on.

                                            • 21. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                              DilipShah Level 1

                                              Here is one more test case with 'better' data:

                                              http://www.blueskylearning.com/printMoreImages/PrintImages.html

                                               

                                              Even in this test case, when I access the URL and click on Print button, it prints 2 pages and on each page, it skips image in row 2.

                                               

                                              I've turned View Source on.

                                              • 22. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                                Flex harUI Adobe Employee

                                                Not sure when I’ll have time to dig in, but a quick look says you are not copying the bitmap so if a bitmap is used in more than one row it won’t show in all of them.

                                                • 23. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                                  DilipShah Level 1

                                                  I have an even simpler example to bring out this issue that I've been encountering.

                                                   

                                                  Go to http://www.blueskylearning.com/printBitmaps/PrintBitmaps.html

                                                  and click on Print button.

                                                  You'll see that bitmap in the second row is missing!

                                                   

                                                  This example simply constructs InlineGraphicElement from a filled circle and uses it along with some static text to build TextFlow.

                                                  PrintDataGrid DataGridColumn's renderer prints the TextFlow and when doing so, skips what's in InlineGraphicElement in the second row of the PrintDataGrid.

                                                   

                                                  The behavior looks like a bug to me.

                                                   


                                                  • 24. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                                    Flex harUI Adobe Employee

                                                    Did you verify you are copying and not re-using bitmaps?

                                                    • 25. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                                      DilipShah Level 1

                                                      InlineGraphicElement object is recreated in the loop and the Sprite object that's the source of InlineGraphicElement object is also recreated in the loop.

                                                      • 26. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                                        DilipShah Level 1

                                                        Hi Flex harUI,

                                                         

                                                        Any suggestion on how to resolve this issue? I'm inclined to file this as a bug so that it gets looked into. In my experience, display as well as printing TextFlow with embedded images via renderers has issues / bugs and need to be addressed.

                                                        • 27. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                                          Flex harUI Adobe Employee

                                                          I think it is a bug in the TLF library.  You can file a bug if you want, but they usually don’t like large Flex test cases.  I’m hoping to find time to pare it down to basics and maybe find a workaround.

                                                          • 28. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                                            Flex harUI Adobe Employee

                                                            I finally got a chance to look into this some more.  I’m pretty sure it isn’t a bug per-se.  The issue is that the data items are can be assigned to more than one renderer.  There is a hidden renderer used to measure renderers and I’m pretty sure it is stealing the icon from that one row.  PrintDataGrid basically can’t handle display objects in the data items.  I’ll see if I can find time to find a workaround.

                                                             

                                                            -Alex

                                                            • 29. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                                              DilipShah Level 1

                                                              Workaround is just fine... anything to make this work!

                                                               

                                                              In the meanwhile, I've switched to iText to generate PDF documents users of my web application need to generate.

                                                              • 30. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                                                Flex harUI Adobe Employee

                                                                I spent a couple of hours on a workaround and gave up.  There is no good way to control the recycling and re-use of renderers and in this case, when the TextFlow gets rendered.

                                                                 

                                                                So, the only way I can get it to work  is to clone or generate the TextFlow in the renderer.  Hope that helps.

                                                                 

                                                                -Alex

                                                                • 31. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                                                  DilipShah Level 1

                                                                  I made changes to my program where I generate bitmaps from images in advance. In the renderer, I create InlineGraphicElement from the bitmap and use it to create paragraph and textflow for the RichText element. Even this produces unpredictable result. In various runs of the application, different images are missing from the printout.

                                                                   

                                                                  I've tried most of the possible approaches but it looks like printing complex data that involve textflow and embedded images doesn't seem to be possible with the current version of Flex SDK (4.5.1). In my opinion, it needs to be looked into because this is a significant hurdle in the use of Text Layout Framework in an application that needs to generate printout.


                                                                  • 32. Re: PrintDataGrid's DataGridColumn - Embedded image not printing when you use TextFlow in the item rende
                                                                    Flex harUI Adobe Employee

                                                                    Please file a bug with your test case.  Basically, the only robust solution for now would be to generate the textflow and its objects on the fly in each renderer.  You cannot cache them in the dataprovider.