<?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>
相关文章
- 03-26net 快速打印日志
- 03-26flex打印图片
- 03-26flutter 图片圆角
- 03-26awt画布的图片保存方法
- 03-26e683. 设置打印的方向
- 03-26获取请求体中图片的二进制流直接解析成图片
- 03-26springboot通过流读图片并展示在浏览器
- 03-26实际开发之图片按比例压缩
- 03-26图片在线url转base64
- 03-26后台返回前台图片二进制byte[]数据,前台获取