码迷,mamicode.com
首页 > 其他好文 > 详细

flex打印图片

时间:2014-06-12 19:00:57      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:http   tar   com   width   art   cti   

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx"
        width="1500" height="900">
 <fx:Script>
  <![CDATA[
   import mx.controls.Alert;
   import mx.printing.FlexPrintJob;
   import mx.printing.FlexPrintJobScaleType;
   private var saveBitmapData:BitmapData;
   private var sp:Sprite;
   private var pj:PrintJob;
   private var print:FlexPrintJob;
   protected function button1_clickHandler(event:MouseEvent):void
   {
    print=new FlexPrintJob();
    print.printAsBitmap=true;
    if(print.start())
    { 
     Alert.show("startBegin");
     try{
      print.addObject(printGroup,FlexPrintJobScaleType.SHOW_ALL);
      Alert.show("addObject");
     }catch(e:Error){
      Alert.show("addObjectError");
     }
     try{
      print.send();
      Alert.show("send");
     }catch(e:Error){
      Alert.show("sendError");
     }
    }else{
     Alert.show("取消或遇到错误");
    }
   }
  ]]>
 </fx:Script>
 <fx:Declarations>
  <!-- 将非可视元素(例如服务、值对象)放在此处 -->
 </fx:Declarations>
 <s:Group id="printGroup">
  <s:BitmapImage id="img" width="1253" height="768" horizontalCenter="0" source="image/1.png"
        verticalCenter="0"/>
 </s:Group>
 <s:Button x="503" y="400" click="button1_clickHandler(event)" content="打印"/>
</s:WindowedApplication>

flex打印图片,布布扣,bubuko.com

flex打印图片

标签:http   tar   com   width   art   cti   

原文地址:http://www.cnblogs.com/dongyl/p/3781731.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!