Flex打印(一)

  用Flex进行打印可能是我迟早要做的事情,因为我在ANNCSR报表中迟早要实现Flash打印。Web应用的打印一直给我带来了困难的挑战,用浏览器来实现应用程序的打印,常常费力不讨好。

  Flex打印利用2个新类来解决:FlexPrintJob和PrintDataGrid。

  FlexPrintJob类会管理打印工作,并起到打印程序接口的作用:使用start()函数调用Print对话框,通过addObject()函数,添加打印项。

     看代码:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<mx:VBox id="printContent" backgroundColor="#FFFFFF">
		<mx:Label text="This is your first print text"/>
	</mx:VBox>
	<mx:Button x="30" y="30" label="Print This" click="testPrint()"/>
	
	<fx:Script>
		<![CDATA[
			import mx.printing.FlexPrintJob;
			
			private function testPrint():void
			{
				var print:FlexPrintJob = new FlexPrintJob();
				
				if(print.start()){
					print.addObject(printContent);
					print.send();
				}
			}
		]]>
	</fx:Script>
</s:Application>

 点击Print This就会弹出打印窗体,可继续打印。 

转载于:https://www.cnblogs.com/lexloo/archive/2011/01/24/1943549.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值