Creating a print window

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Creating a print window

    I am working on creating a print window (TitleWindow) that can be used
    throughout my application as a "canvas" to drop in visual objects that need to
    be printed. I opted for this route because I can add a header or footer and
    control the size of the window. I can call the print window and pass it a
    header just fine because it is merely a string object bound to a label on the
    print window. My problem comes in passing the print window a visual object
    (ie. VBox) that I want added to the print window. I have tried using the
    createChild() method for the TitleWindow and also creating a static VBox that
    holds all of the print content and using its createChild() method to add the
    passed in VBox to the window. No luck. Any suggestions would be great.

    printScreen = mx.managers.PopUpManager.createPopUp(_root, printCanvas, true,
    {printHeader:cSummary, printBody:someVBox});


    <mx:TitleWindow xmlns:mx="http://www.macromedia.com/2003/mxml" width="600"
    height="700" creationComplete="initContent()">

    <mx:Script>
    <![CDATA[
    var printHeader:String;
    var printBody:mx.containers.VBox;

    function initContent() {

    var printDetail = printContent.createChild(printBody, "detail");
    }

    function startPrint() {

    var pageCount:Number = 0;

    var my_pj:PrintJob = new PrintJob();

    if (my_pj.start())
    {
    // Print the content of this window
    my_pj.addPage(printContent);

    }

    // If addPage() was successful at least once, print the spooled pages.
    if (pageCount > 0){
    my_pj.send();
    }
    delete my_pj;

    }
    ]]>
    </mx:Script>

    <mx:VBox id="printContent" width="100%" height="100%">

    <mx:Label id="header" text="{printHeader}"></mx:Label>

    <mx:Spacer height="20"></mx:Spacer>

    </mx:VBox>

    </mx:TitleWindow>

    jmicah Guest

  2. Similar Questions and Discussions

    1. Creating PDFs from Freehand -- print to PDFvs. export vs. print/scan to PDF?
      I've had a lot of compatibility problems with created presentations so have started using Acrobat instead of trying to export my Macromedia Freehand...
    2. Help with javascript:window.print()
      I am trying to send a specific page to the printer using javascript:window.print(). There has to be a way top so this. I assume the variable can...
    3. Trouble with javascript:window.print
      My page is an ASP with a lot of VB. Go to http://71.97.138.65/isgmsds/ Then go to http://71.97.138.65/isgmsds/search(new).asp?t=i You will...
    4. Bringing up the PRINT window
      Thanks to those who helped me out with this question before. I'm using the "getURL" command on a button in Flash to open a document in a separate...
    5. Discrepancy in color between Photoshop window and print window
      My photos look very dark and saturated when I load them in Photoshop 7 or Photoshop Elements 2.0, but when viewed in the printer's preview window...
  3. #2

    Default Re: Creating a print window

    Printing in Flex 1.5 sucks.

    Also, it sounds like you are trying to "re-parent" a component into your title
    window, but this is not possible in 1.5.

    I hope someone can correct me, but the only way to print succesfully is to
    have an entire static component for each print view you want.

    That said, I advise continuing on the trachkyou are on for a while. Try
    passing a reference to the main application scope into the title window. Then
    try using this reference to get your PrintContent.

    [url]http://www.cflex.net/showfiledetails.cfm?ObjectID=197[/url]

    Let us know if you have any success.

    Tracy

    ntsiii Guest

  4. #3

    Default Re: Creating a print window

    I realized after I made the post that the problem was probably related to
    reparenting and you just affirmed my hypothesis. Before I read your post I
    decided to go the route of a static print window for each different screen I
    wanted to print. So basically, I went the route you suggested and it seems to
    be working fine. Another issue that I had to work around though was the fact
    that my application must consider people running 800 x 600 resolutions which
    gives me very little real estate for printing since what prints is what is
    showing on the screen. The printing functionality is very disappointing. I
    guess we'll see what they do for 2.0. Thanks for your reply.

    jmicah Guest

  5. #4

    Default Re: Creating a print window

    " printing functionality is very disappointing" yeah.

    You probably know this but you can print more than a screen's worth in a print
    job, it is just that you can only print one screen's worth per page.

    Tracy

    ntsiii Guest

  6. #5

    Default Re: Creating a print window

    Yes I did know that, but thanks for the heads up anyway. I would rather be
    able to use the entire printable page instead of maybe half per page. That
    really looks unprofessional. Thanks again for your help.

    jmicah Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139