4 Replies Latest reply on Mar 18, 2011 3:28 AM by solapola

    Flex PrintJob



      I have a problem with the PrintJob and fitting the pages to the A4 size.

      I add to the PrintJob a list of objects and for presentation I use the PrintDataGrid, using only a column and inside a spark List component. I attach the example:


      private function doPrint(event:FlexEvent = null):void


      var printJob:FlexPrintJob = new FlexPrintJob();

      if (printJob.start())


      printJob.addObject(taskListView, FlexPrintJobScaleType.NONE);





      <mx:PrintDataGrid  id="taskListView" dataProvider="{hostComponent.taskList}" borderVisible="false" width="100%" >


      <mx:DataGridColumn itemRenderer="com.tecfa.tseo.theme.tecfa.editor.print.PrintTaskItemRenderer" />


      </mx:PrintDataGrid > 


      The PrintTaskItemRenderer is a s:ItemRenderer with spark components.

      The thing is "sizeToPage" attributte is not working, anyone had solve this problem, or I have to use only PrintDataGrid and no components inside?


      Thank you

        • 1. Re: Flex PrintJob
          Flex harUI Adobe Employee

          Does the renderer correctly report its measuredWidth?

          • 2. Re: Flex PrintJob
            solapola Level 1

            Yes, the width it's ok

            I think the problem is with the ItemRenderer and is not fitting the objects in the pages, the objects are appearing cutted when a page finish ..


            Thats my Item Renderer, and I hacve another ItemRenderer Inside, maybe too much for Flex print?





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

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











            import com.tecfa.tseo.theme.tecfa.graphic.icon.*;


            import mx.controls.listClasses.IListItemRenderer;






            <!-- Main content -->



            <s:HGroup horizontalAlign="left">

            <s:Label width="40" text="{resourceManager.getString('editor', 'printView.id')}"/>

            <s:Label width="60" text="{resourceManager.getString('editor', 'printView.state')}"/>

            <s:Label width="40" text="{resourceManager.getString('editor', 'printView.page')}"/>

            <s:Label width="100" text="{resourceManager.getString('editor', 'printView.category')}"/>


                    <s:HGroup horizontalAlign="left">

            <s:Label width="40" text="{data.id}"/>

            <s:Group width="60">

            <component:IconButton iconUp="{ViewUnreadPenfingFeedback}"


            <component:IconButton iconUp="{ViewPendingFeedback}"


            <component:IconButton iconUp="{ViewValidatedFeedback}"



            <s:Label width="40" text="{data.page.id}"/>

            <s:Label width="100" text="{data.category.name}"/>


            <s:HGroup horizontalAlign="left" paddingLeft="30">

            <s:Label width="40" text="{resourceManager.getString('editor', 'printView.id')}"/>

            <s:Label width="40" text="!!"/>

            <s:Label width="100" text="{resourceManager.getString('editor', 'printView.author')}"/>

            <s:Label width="90" text="{resourceManager.getString('editor', 'printView.date')}"/>


            <s:List id="commentList" itemRenderer="com.tecfa.tseo.theme.tecfa.editor.print.PrintTaskCommentItemRenderer"

            borderVisible="true" dataProvider="{data.comments}" width="600" >


            <s:VerticalLayout paddingLeft="30" />







            • 3. Re: Flex PrintJob
              Flex harUI Adobe Employee

              Check the measuredHeight.  I'll bet it isn't right.  It doesn't look like

              you have enough height constraints to get it to calculate correctly.

              • 4. Re: Flex PrintJob
                solapola Level 1

                Yes! that was the problem..

                I have to use something like this :




                Now is not detecting when to start new pages in the validNextPage maybe because I'm using skins, but that's another problem..


                Thanx a lot