sure, here's a simple example of printing a view:

<canvas width="400" height="400">

    <view y="50" x="50" id="myview">
                <view width="50" height="50" bgcolor="blue"/>
                <view width="50" height="50" bgcolor="red"/>
                <simplelayout axis="x"/>
    </view>

    <button x="50" y="150">Print It
         <method event="onclick">
                  // create new PrintJob object, and the print dialog to 
appear
                  var printJob = new PrintJob();

                  // this will wait for an OK from the dialog to print
                  if (printJob.start()) {

                       // get your view as a flash movie
                       var viewAsMovie = myview.__LZmovieClipRef;

                       //create a print area object, which will be relative 
to myview (just showing the blue
                       // and red views)
                       var printArea = {xMin:0, xMax:100, yMin:0, yMax:50}

                       // add a page to the print job with the movie
                       printJob.addPage(eval(viewAsMovie), printArea);

                      // send it to the printer
                      printJob.send()

                  }
                  delete printJob;

         </method>
    </button>
</canvas>


- clint


>From: Daniel Salama <[EMAIL PROTECTED]>
>To: Clint Dickson <[EMAIL PROTECTED]>
>CC: [email protected]
>Subject: Re: [Laszlo-user] Printing and others
>Date: Wed, 31 May 2006 12:33:25 -0400
>
>Clint,
>
>This is all very nice. I received suggestions from others on using  this 
>approach. What I'm not familiar with is how do I call Flash's  API from 
>within my lzx code. Can you please elaborate more or point  me in the right 
>direction?
>
>Thanks,
>Daniel
>
>On May 30, 2006, at 1:54 PM, Clint Dickson wrote:
>
>>Hi Daniel,
>>
>>We use the Flash API's to print from our application Gliffy   
>>(http://www.gliffy.com).  The reference material is here:
>>
>>http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/ 
>>html/wwhelp.htm?context=LiveDocs_Parts&file=00002608.html
>>
>>You can create a PrintJob class directly from your script code.   The only 
>>caveat is that the communication to the printer to change  the paper size 
>>or layout you want is  not available from the Flash  API (at least we 
>>haven't figured it out).  We use user messaging to  alleviate this.
>>
>>Hope this helps,
>>
>>-Clint
>>
>>
>>
>>>From: Daniel Salama <[EMAIL PROTECTED]>
>>>To: Laszlo <[email protected]>
>>>Subject: [Laszlo-user] Printing and others
>>>Date: Tue, 30 May 2006 09:24:39 -0400
>>>
>>>I thought I would ask one more time.
>>>
>>>As I've read, the browser cannot print flash movies. Therefore, any
>>>printing support from within a flash movie has to be done within the
>>>flash itself.
>>>
>>>I have been reading through the docs and could not find any reference
>>>to printing support from within Laszlo apps. I searched through the
>>>wiki and found some references to a proposal to add printing support,
>>>but I don't think it's been done yet.
>>>
>>>However, I see that LaszloMail does offer printing of messages and I
>>>REALLY would like to know how that's done. We're working on
>>>delivering an app to a client which must have printing support. We
>>>took the risk of doing it with Laszlo as we believe it's a great
>>>platform, even though we are still novices at it. We figured there is
>>>no better way to learn than to be put in front of the fire :)
>>>
>>>The "others" part of the subject line refers to content returned by a
>>>back end application server. We are connecting our Laszlo app to a
>>>back-end via a REST-like API. However, there are some requests that
>>>the response from the server is either a CSV or XLS file or a PDF
>>>document. How can a Laszlo app handle these types of responses? At
>>>first, I thought of just launching an LzBrowser for the response and
>>>just let the browser handle the MIME type. Is that the correct
>>>approach? Is there a better one?
>>>
>>>Anyway, any suggestions?
>>>
>>>Thanks,
>>>Daniel
>>>_______________________________________________
>>>Laszlo-user mailing list
>>>[email protected]
>>>http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>>
>>
>


_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to