老不死的Flash程序员

Adobe不玩Flash了,叫我们这老Flasher情以何堪啊!

未公开的Openlaszlo应用打印功能

自从一年前使用openlaslzo以来,就知道它有个缺陷,就是不能打印界面上东西,现在终于在今天的邮件列表中看到了解决方案,是调用flash的打印函数进行打印的,这下终于有办法了,下面的样例文件:

--------------------------------------------------------------------
laszlo print sample code From: "Clint Dickson" <clintjd@hotmail.com>
--------------------------------------------------------------------
<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>

非常高兴,openlaszlo越来越让人满意了,继续支持!

阅读更多
个人分类: RIA开发技术
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

未公开的Openlaszlo应用打印功能

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭