Flex列印(一)

來源:互聯網
上載者:User

  用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就會彈出列印表單,可繼續列印。 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.