Flex Printing

I am sending a datagrid to print as file (.pdf) from Flex3
AIR app. on Mac OSX.
If the document exceeds 5 pages, the print call fails ... as
if out of memory. I
don't have this problem under 5 pages. Has anyone had or
heard of this issue?

I am trying to do something similar and had the exact same
problem. I am trying to have a company logo dynamically added to a
print job. All attempts at changing the source field on the image
tag before printing failed. I tried creating an image object and
adding to my print view before printing also failed. The image was
generated and displayed on the screen after the print job left the
computer. After trying a few ideas, I came up with this one that
works but is ugly.
The print job will take a completed object on the screen and
add to the print view and then print correctly. So the solution was
to create a "hidden" image of the logo when opening the report
generator. I placed an image tag ahead of the data grid with both
overlappnig on the screen. This makes the image hidden since the
data grid comes later in the code. You then start the print job and
add the hidden complete image to the print view. this prints
correctly. Unfortunately, I found that the addObject function eats
the mxml generated image so no second print attempt! To fix that,
it turns out that if you generate dyanamically a second copy of the
image tag upon opening the report generator, the addObject eats the
static version and leaves the dynamically version alone. You can
then print with the logo image with no problems repeatedly.
As mentioned, this seems very ugly but I have now printed
hundreds of different combinations and it seems to keep working.
If anyone knows of a better solution, I would be very
interested.

Similar Messages

  • Flex Print Job not working with custom component

    Hi All,
    I have to print pages with header, body and footer. So the thought process was to create a custom component fro header, footer and body. Header component is based on Box, Body is a renderer (which will have fix value of items - and will decide the number of possible pages) and footer is again based on Box.
    But when i created a simple Custom component like this for header
    <?xml version="1.0" encoding="utf-8"?>
      <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">
    <fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <mx:HBox>      <mx:Label id="testLabel" text="Test Container"/>
    </mx:HBox> 
    </mx:VBox>
    Then when i try to add this to FlexPrintJob, and save it as 'xps' to see the print output, i get error message that this file is in use or damaged.
        var myPrintJob:FlexPrintJob = new FlexPrintJob();
      if(!myPrintJob.start()){
          return;
    var header:Header = new Header();
    header.width = myPrintJob.pageWidth;
    header.visible = false;
    FlexGlobals.topLevelApplication.addChild(panierPrintHeader);
    myPrintJob.addObject(header);
    myPrintJob.send();
    FlexGlobals.topLevelApplication.removeChild(panierPrintHeader);
     But this does not work and i get the above mentioned exception. Now when i not use the custom component and just have a label or HBox or anything on stage before the print functionality is invoked, it works fine. And this too haapens only if you have a mxml component, i tried by creating a new Label component using actionscript and then provide the same to the printJob, which did not work either. I need help on this, else i will have to take print functionality to server side(Java) which has some business implications, the reason why i am spending time on flex for printing. 
    Thanks and Regards,
    Jigar
    Looks like custom component print is not working fine with flex or i am doing something terribly wrong.
    Looking forward for help.

    Is there nobody in flex community who can help on this....
    Looks like a toothless class that adobe actionscript team has provided, which is not liked across much

  • Flex, Printing / Create PDF  without Server?!?

    Hi,
    after some days of searching a printing solution for flex without using a server or using a second languag (Java), I found the following solutions:
    www.alivepdf.org
    and
    www.bentbit.com
    Is there something else out there?!?!?
    I can not understand why Adobe, the "mother" of PDF, does not have a nice solution for it?!?!?!
    Cheers!
    mz

    It would probably be a good idea to explain why the solutions you've found are unsuitable.

  • Flex printing broken by Flash 10.1.53.64 upgrade

    We have a large base of flex applications whose printing is now broken on any machine which upgrades to the 10.1.53.64 Flash upgrade.  The pages print with white vertical and horizontal bars running through them.  Have definitely verified that this is related to the Flash upgrade.  Is anyone else experiencing this problem?

    For anyone interested, we discovered that the problem Flash 10.1.53.64 introduced was related to a mask used on the print page.  By removing the mask and using a different technique we were able to work around the problem.  Definitely a potential problem for anyone using a mask on a print page though.

  • Flex Printing Issue

    Dear All,
    I have used the following code to print from flex Datagrid in
    Flex 1.5.
    public function doPrint():Void {
    var pj : PrintJob = new PrintJob();
    //Save the current vertical scroll position of the DataGrid
    control.
    var prev_vPosition:Number = dgReportFinal.vPosition;
    if(pj.start() != true) {
    delete pj;
    return;
    //Calculate the number of visible rows.
    var rowsPerPage:Number = Math.floor((dgReportFinal.height -
    dgReportFinal.rowHeight)/dgReportFinal.rowHeight);
    //Calculate the number of pages required to print all rows.
    var pages:Number =
    Math.ceil(dgReportFinal.dataProvider.length / rowsPerPage);
    //Scroll down each page of rows, then call addPage() once
    for each page.
    for (var i=0;i<pages;i++) {
    dgReportFinal.vPosition = i*rowsPerPage;
    pj.addPage(dgReportFinal);
    pj.send();
    delete pj;
    // Restore vertical scroll position.
    dgReportFinal.vPosition = prev_vPosition;
    My Issues are:
    1. I want content of the DataGrid to be printed, but the
    printing prints the content of the datagrid along with the
    scrollbars.
    This is the same, when I use landscape mode also.
    2. When the content of the Datagrid exceeds the width of the
    Datagrid (i.e., when we have a hscroll), those contents are not
    printed. I think only the content which we view currently is being
    printed.
    To print headers and footers which are the best controls to
    use. Bcoz my headers would look like:
    Date: Organization:
    Place: Branch:
    Report Title
    Thanks in advance.
    thanks and regards,
    Loganathan.P.C.

    The feature of printing data which is not visible in the
    control is not available in Flex 1.5 but is available in Flex 2
    (Beta). Work around can be fragmenting the data as pages for
    printing but involves splitting data in grid into a fixed number of
    rows for each page.
    I can also suggest a work around for you header and footer
    issue. you can create a sepearate Print Preview Page which can be
    invisible / visible as you wish and on click of print use the
    controls in that page and print
    tipically the Preview page can be like
    mx:Label ---> Header text
    mx
    ataGrid -- > data which is paged -
    mx:Label --- > footer

  • Flex print problem

    Hi guys,
                     i want to print one canvas(3/4 page) and then followed by some text, images, lists(dynamic), i googled the stuff mostly it says printdatagrid, what if
    we have different things like images, lists, formatted text, flex will automatically set the pages or we have specify the pages, since i have some lists in it i cant
    tell the height, so how to solve this problem.
    thanks for going through.

    it seems like we have to provide the dataprovider when the print start() is called.

  • Flex printing in the enlarged page

    Hello friends,
    Have one on my canvas.I am doing away with the mouse close to the.Enlarge and print only the visible part of the printed page, we make.What can I do to print the entire.
    Is it possible to print multiple pages fit on a page by dividing the screen?
    Thanks.

    Hi,
    I get the following error during the printing PrintJob.
    Error : #2141 Only one PrintJob may be in use at a time.
    Do you have faced before.
    Thanks.

  • Problem with Flex print- characters are being chopped off

    help please

    Bottom of the page characters are being chopped off I am
    using
    private function doPrint():void {
    var myPrintJob:FlexPrintJob = new FlexPrintJob();
    myPrintJob.start();
    myPrintJob.addObject(printArea1);
    myPrintJob.send();
    Code is:
    <mx:Canvas backgroundColor="white" height="70%"
    width="100%" visible="true">
    <!-- The following part of the code being executed when
    user clics on Print Button -->
    <mx:VBox width="90%" height="100%" visible="true"
    id='printArea1' includeInLayout="true">
    <mx:VBox paddingLeft="0" paddingRight="0"
    horizontalGap="0" >
    <mx:HBox>
    <mx:VBox width="20%">
    <mx:HBox>
    <mx:Label styleName="printFont" text="Role:"
    width="50"/>
    <mx:Label styleName="printFont"
    text="{role.selectedItem.DAFYROLE}"/>
    </mx:HBox>
    </mx:VBox>
    <mx:VBox width="40%">
    <mx:HBox id='idPrintFacility'>
    <mx:Label styleName="printFont" text="Facility:"/>
    <mx:Label styleName="printFont"
    text="{facs.selectedItem.LABEL}"/>
    </mx:HBox>
    </mx:VBox>
    <mx:VBox width="30%">
    <mx:HBox>
    <mx:Label styleName="printFont" text="Patient:"/>
    <mx:Label styleName="printFont"
    text="{patient.selectedItem.LABEL}"/>
    </mx:HBox>
    </mx:VBox>
    </mx:HBox>
    <mx:HBox>
    <mx:VBox width="20%">
    <mx:HBox>
    <mx:Label styleName="printFont" text="Filter By:"/>
    <mx:Label styleName="printFont" text="{filter.text}"/>
    </mx:HBox>
    </mx:VBox>
    <mx:VBox width="40%">
    <mx:HBox>
    <mx:Label styleName="printFont" text="From"/>
    <mx:Label styleName="printFont"
    text="{fromDate.text}"/>
    <mx:Label styleName="printFont" text="To"/>
    <mx:Label styleName="printFont" text="{toDate.text}"/>
    </mx:HBox>
    </mx:VBox>
    </mx:HBox>
    </mx:VBox>
    <mx:Repeater id="idCatsx" dataProvider="{myNotes}"
    width="100%" >
    <mx:HBox id="idCatLabel">
    <mx:HBox>
    <mx:Label styleName="printFontBold"
    text="{idCatsx.currentItem.LABEL}" fontWeight="bold" />
    </mx:HBox>
    <mx:HBox>
    <mx:Spacer width="10"/>
    </mx:HBox>
    </mx:HBox>
    <mx:HBox width="100%">
    <mx:VBox width="10%">
    <mx:Spacer width="10"/>
    </mx:VBox>
    <mx:VBox width="90%" height="100%">
    <mx:Repeater id="idTipsx"
    dataProvider="{idCatsx.currentItem.NOTES}" >
    <mx:HBox width="100%" verticalGap="0" >
    <mx:VBox>
    <mx:Label styleName="printFont"
    text="{idTipsx.currentItem.NOTES_DATE}" />
    </mx:VBox>
    <mx:VBox height="100%">
    <mx:HBox height="100%">
    <mx:Text width="500" styleName="printFont"
    text="{idTipsx.currentItem.NOTE_TEXT}" />
    </mx:HBox>
    <mx:HBox height="100%">
    <mx:Text styleName="bold" width="600"
    text="{idTipsx.currentItem.ADDMODIFYTEXT} on
    {idTipsx.currentItem.TIME_STAMP} for Assessment
    Date:{idTipsx.currentItem.ENCDATE_DATE}" />
    </mx:HBox>
    </mx:VBox>
    </mx:HBox>
    <mx:HBox verticalGap="0">
    <mx:VBox width="100%" verticalAlign="top" verticalGap="0"
    height="100%">
    <mx:VBox >
    <mx:Repeater id="idHistx"
    dataProvider="{idTipsx.currentItem.HIST}">
    <mx:HBox width="100%" >
    <mx:VBox>
    <mx:Spacer width="115"/>
    </mx:VBox>
    <mx:Canvas height="100%">
    <comp:StrikeThroughText width="500" height="100%"
    styleName="printFont"
    text="{unescape(idHistx.currentItem.NOTE_TEXT)}"/>
    </mx:Canvas>
    </mx:HBox>
    <mx:HBox>
    <mx:VBox>
    <mx:Spacer width="115"/>
    </mx:VBox>
    <mx:VBox height="100%" width="100%">
    <mx:Text width="600" styleName="bold" text="Notes
    {idHistx.currentItem.ADDMODIFYTEXT} on
    {idHistx.currentItem.TIME_STAMP} for Assessment
    Date:{idTipsx.currentItem.ENCDATE_DATE}" />
    </mx:VBox>
    </mx:HBox>
    </mx:Repeater>
    </mx:VBox>
    </mx:VBox>
    </mx:HBox>
    </mx:Repeater>
    </mx:VBox>
    </mx:HBox>
    </mx:Repeater>
    </mx:VBox>
    </mx:Canvas>

  • Send MXML to Java printing Gateway

    Hi everybody, i´m developing a printgateway in java to overcome the limitations of the Flex print API. Here´s what i´m doing.
    I create a report in Flex and want to send it to the java gateway via sockets.
    What a wanted to know is hot to send the report object to my java gateway and print this from there (where i can print directly to the desired printer - without print dialogs to the user.).

    i've since tried this code, but am essentially receiving the same result.
       FileInputStream psStream = null;
            try {
                psStream = new FileInputStream("c://testPDF.pdf");
            } catch (FileNotFoundException ffne) {
                ffne.printStackTrace();}
            if (psStream == null) {
                return;}
            DocFlavor psInFormat = DocFlavor.INPUT_STREAM.AUTOSENSE;
            Doc myDoc = new SimpleDoc(psStream, psInFormat, null);
            PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
            PrintService[] services = PrintServiceLookup.lookupPrintServices(psInFormat, aset);
            // this step is necessary because I have several printers configured
            PrintService myPrinter = null;
            for (int i = 0; i < services.length; i++){
                String svcName = services.toString();
    System.out.println("service found: "+svcName);
    if (svcName.contains("Dell 3100cn PS")){
    myPrinter = services[i];
    System.out.println("my printer found: " + i + " svc = " +svcName);
    break;
    if (myPrinter != null) {
    DocPrintJob job = myPrinter.createPrintJob();
    try {           
    job.print(myDoc, aset);
    System.out.println("printed");
    } catch (Exception pe) {pe.printStackTrace();}
    } else {            System.out.println("no printer services found");

  • Perl cgi upload stopped working with Flash 10

    First let me just say that PHP is not an option in my environment. Its just not allowed to be used.
    I have some really basic Perl upload scripts that work find with flash 9 and below. However since flash 10 these no longer work. I tried using FileRefernce and while I can get all my values as defined by the
    $QUERY_VALS_GV->param statement in Perl, I can not get the file handle $QUERY_VALS_GV->upload("fileName"); Any Ideas ?  
    Snippet
     use CGI;
    use CGI qw(:standard);
    use CGI::Carp qw/fatalsToBrowser/;
    # Values from Flex #
    print header();
    our $QUERY_VALS_GV = new CGI
    our $UPLOAD_FILE_NM_GV = "";
    our $DOC_TYPE_IP = $QUERY_VALS_GV->param("docType");
    our $USER_NAME_IP = $QUERY_VALS_GV->param("userName");
    our $WR_ID_IP = $QUERY_VALS_GV->param("wrId");
    our $WR_TYPE_CD_IP = $QUERY_VALS_GV->param("wrTypeCd");
    our $FILE_NM_IP = $QUERY_VALS_GV->param("fileName");
    our $ACTION_IP = $QUERY_VALS_GV->param("fileAction");our $UPLOAD_FHDL_IP = $QUERY_VALS_GV->upload("fileName");

    The resolution was easy. Use the default value for Filedata passed from filereference
    our $UPLOAD_FHDL_IP     = $QUERY_VALS_GV->upload("Filedata");

  • Incorrect output in PrintDataGrids

    Hello Flex Community,
    I have an exciting problem and hope anybody can help me. My
    application does the following:
    1. I have a panel with two DataGrids one below the other,
    which are filled with more than 100 rows.
    2. I want to print these DataGrids. I tried to do this - as
    decribed in the LiveDocs - with PrintDataGRids.
    3. I want that the first DataGrid is printed completely on
    multiple pages and finally the second DataGrid.
    My problem is that each printed page visualizes both
    PrintDataGrids with 10 items in each case. And that is done for the
    next 10 pages.
    Question: How can I enforce that Flex prints at first the one
    DataGrid completely on multiple pages and then the second one???
    Gruß Greenhorn

    This is a major feature of Flex - inability to print.
    You've bumped into the problem that assigning 100% height to
    the PDG gets you into the described case.
    FlashPLayer uses 2 passes to layout the elements. So, at the
    first pass you've got 2 PDGs with 100% height and this thing drives
    FP nuts.
    As a solution you have to manually calculate available height
    and set PDG.height to that value, one PDG at a time.
    In my project I am using N-pass technique to layout all
    elements correctly, but still I can't overcome all the problems
    with mighty "Flex Printing Engine"
    PS I am inclined to think that server-side printing solution
    is the way to go.(like PDFLib)
    Cheers,
    Dmitri.

  • My Ipod was white but now it's black

    So, a week ago I dropped my Ipod and the screen turned white.I tried reseting it and restoring it but it still is white. I opened it up to check if anything was out of place and closed it.Now the screen is black. Can you guys help me?

    A white screen means the video electronics cannot "talk" to the LCD display panel.  A black screen means the back light (a really small and fragile flourescent light) is not working, or the iPod is not powering up.
    What could have happened when you opened the iPod is you disconnected the touch screen or you may have damaged the flex print cable that connects the touch screen to the main board.  This will keep the iPod from powering up.
    The bottom line is, you're hosed, but you do have some options:  You can buy a new iPod, or you can invest in a new LCD panel and mabye a touch screen and then see if you can fix what you broke...  parts are available on line.  eBay and Google are your friends....

  • Adobe... PrintDataGrid needs previousPage()

    It's difficult to provide the ability to go back a page when
    showing the user a print preview. It's assumed functionality in
    every print preview interface.
    Come on Adobe, we need better printing support for Flash/Flex
    in general. The OS should be able to handle stuff like which pages
    to print, and print orientation too. Very generic, basic
    functionality. Why are we still doing this in Flex? The Silverlight
    punks are gonna catch up at this rate. :P

    Also: since technically when we print multiple pages by
    queuing them up in separate print jobs (as the Flex printing
    example in the docs), doesn't that mean if other people print stuff
    while your Flex print jobs are running, it'll end up in between
    your pages?
    That really sucks. Better print support is needed if Adobe
    wants businesses to use Flex extensively. ^_^ And I don't even want
    to think about the performance hit (if any) you take printing lots
    of pages like that...

  • Printing a graphic with a gradient mask in Flex 3-problem

    Hello, I am fairly new to flex development. I am puting together a little program that allows the user to upload a picture add a vignette mask in order to achieve a soft edge,  and have a problem I cannot  find an answer anywhere, maybe someone could help me please.
    I want  to print a the user photo with a gradient mask or vignette from flex. I managed  to show the image correctly on screeen with the gradient mask using  this class but the output to paper is a rectangle without the soft mask.
    //package to add the mask for display
    package com.dm.graphics
       import flash.display.Graphics;
       import mx.containers.Canvas;
       import flash.display.GradientType;
       public class FrameBorderSoft extends Canvas
          override protected function updateDisplayList(w:Number, h:Number):void
             super.updateDisplayList(w,h);
             var g:Graphics = this.graphics;
             g.clear();
             g.beginGradientFill(GradientType.RADIAL, [0x000000, 0x000000, 0x000000, 0x000000],
             [1,1,0.8,0],
             [1,128,195,255],
             horizontalGradientMatrix(0,0,w,h) );
             g.drawRect(0,0,w,h);
             g.endFill();
    It  works beautifully until I try to print the graphic. The image prints  but without the gradient edges (soft) instead it is just a sharp edge  rectangle.
    Does anyone know how to do this?
    Here is my print function:
    private function doPrint():void {
                    // Create an instance of the FlexPrintJob class.
                    var myPrintJob:FlexPrintJob = new FlexPrintJob();
                    // Start the print job.
                    if (myPrintJob.start() != true) return;
                    // Add the object to print. Do not scale it.
                    if (tabnavigator1.selectedChild == img1) {
               //switchcolor is a variable to detect if the user changed the background to white or clear.       
                             switchcolor = 100;
                          //printCF is the card front container with the photo masked
                       myPrintJob.addObject(printCF, FlexPrintJobScaleType.NONE);
                       myPrintJob.printAsBitmap = false;        
                    } else if (tabnavigator1.selectedChild == img1b) {
                       switchcolor = 100;
                       myPrintJob.addObject(printCB, FlexPrintJobScaleType.NONE);
    I hope this helps to visualize,
    I would greatly appreciate any assistance or advise.

    Hello, back on my issue, i tested a little bit more the message dispaching.
    I read the lazyLoadPolicy class and noticed that it always has to have a ModuleId property in the message to work, that's why the broadcast message didn't work to awake the module with the lazy loading policy.
    So i added copy of my module:
         <cairngorm:ParsleyModuleDescriptor objectId="test"
              url="TestModule.swf"
              applicationDomain="{ClassInfo.currentDomain}"
         />
         <cairngorm:ParsleyModuleDescriptor objectId="testbis"
              url="TestModuleBis.swf"
              applicationDomain="{ClassInfo.currentDomain}"
         />     
    Set them both with a basicLoadPolicy, and tries to dispatch a message to only one of them using the ModuleId metatag. I then noticed that both modules received the message and not only the one i expected.
    I then changed the ModuleMessageInterceptor configuration to dispatch to only one kind of module:
    <cairngorm:ModuleMessageInterceptor type="{ OpenViewMessage }" moduleRef="test"/>
    and this worked as expected. Only the first module catched the message. I am obiously messing with the ModuleId metatag but i cannot see what's wrong...
    I compiled with
    -keep-as3-metadata+=ModuleId
    but this hasn't changed anything...

  • How to print text/data in flex 3 using printer???Plz help...

       Hi,
              plz tell me the way to print text/data using printer in flex.  I tried the FlexPrintJob class. but it takes object of a container to be printed & prints the visible content of that container(along with scrollbars), bt i want to print all contents of the container(including invisible).
          I have tried to print bitmap image through FlexPrintJob but it takes lot of time for spooling... So plz help me out in printing(fast with all content) in flash
    I am using flex 3 (flex Builder 3 IDE).
      Thanks in advance!!!

    Hi Sagar,
    Don't worry You can use the below work around to print all the contents of the Container including the invisible contents under scrolll with out scroll bar..
    So what the idea here is we are seeting the container height to full size with out scrolls before sending the container object to printer and as soon as you print the object you are restoring it to the original height with scrolls...so that you can print the full contents without scrolls...
    You may have doubt that by chnaging and restoring the size the user may see momentary resize of the container but it is not so as it is a fraction of a second and user cannot notice this change... Give it a try ..I had already run into this problem recently and I have found a work around for this which is as below:
    // Here mainContainer is the container or box id the contents of which you want to print
       private function doPrintContainer():void
        var printJob:FlexPrintJob = new FlexPrintJob();
        if(printJob.start() != true) return;
        try
         var mainContainerHeight:int = mainContainer.height;
         //Increasing the height of the desired component to be printed.
         mainContainer.height = mainContainer.measuredMinHeight;
         mainContainer.verticalScrollPolicy = "off";
         //Adding the resized Component to our FlexPrintjob and then sending the print request
         printJob.addObject(this,FlexPrintJobScaleType.MATCH_WIDTH);    
         printJob.send();
         //Resizing the component back to normal size
         mainContainer.height = mainContainerHeight;
         mainContainer.verticalScrollPolicy = "auto";    
        catch(error:Error)
                     trace("Error : " + error.message);
    If this post answers your question or helps, please kindly mark it as such.
    Thanks,
    Bhasker Chari

Maybe you are looking for

  • New iTunes 10 for the iOS 6 keeps freezing

    I recently updated my iOS for my iPhone 4s to the 6. When I plugged it into my computer, iTunes tells me I have to update it as well. Now, iTunes keeps freezing on me or saying that it can't connect to my phone for some reason. I'm kind of annoyed wi

  • My mouse won't open files anymore

    I have a MacBook and it has suddenly developed a very annoying problem.  It works fine immediately after a reboot but after awhile I can select files and applications with the mouse but I cannot open anything with it.  It does not matter if I use the

  • Error on log on

    i ws workin on my laptop standalone server.. and system shutdown .. and rebooted when i strated the server again it gives eror "snap-in creation failed"... the snap-in is not created,it may not be installed properly . name: sap r/3 manager CLSID:{633

  • When uninstalling an older version of reader, I get an error message about transform paths

    I tried to uninstall version 8.1.2, and I get an error message to verify that the specified transform paths are valid. Some body please help. I could use the 90mb of space it's taking up. My system is a laptop, vista 32 bit. No security update issues

  • Problem updating iOS 5

    Hello Everytime I finish downloading the 'iPod Software Update' for my iPod Touch 4G, an error message shows up saying "There was a problem downloading the software for the ipod. The network connection has timed out." although I am still connected to