关闭

未公开的Openlaszlo应用打印功能

1508人阅读 评论(0) 收藏 举报

自从一年前使用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越来越让人满意了,继续支持!

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:191009次
    • 积分:2632
    • 等级:
    • 排名:第13809名
    • 原创:63篇
    • 转载:1篇
    • 译文:2篇
    • 评论:63条
    远博畅享
    北京远博畅享科技有限公司,致力于文化创意产业方向的移动应用开发,从事艺术、广告、游戏等应用开发,欢迎联系,欢迎各种交流!
    公司网址
    Email: lwz7512[at]gmail.com
    QQ:626528719,加Q时告诉我从CSDN看到的,谢谢!