我正在为沙龙创建 AIR 应用程序,我想以小页打印发票。
我怎样才能实现这些???请帮我
谢谢。
Web 示例可以将其转换为 AIR: - 请查找示例 dataGrid 打印以及如何将其更改为 250*250。您可以仅为打印视图创建自定义组件布局并在其中包含打印组件。
<?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>
<fx:Script>
<![CDATA[
import mx.printing.*;
// Create a PrintJob instance.
private function doPrint():void {
var printJob:FlexPrintJob = new FlexPrintJob();
if (printJob.start() != true)
return;
myDataGridPrint.height = 250;
myDataGridPrint.width = 250;
myDataGridPrint.dataProvider = myDataGrid.dataProvider;
printJob.addObject(myDataGridPrint, FlexPrintJobScaleType.NONE);
printJob.send();
}
]]>
</fx:Script>
<mx:VBox id="myVBox">
<mx:DataGrid id="myDataGrid" width="300">
<mx:dataProvider>
<fx:Object Product="Flash" Code="1000"/>
<fx:Object Product="Flex" Code="2000"/>
<fx:Object Product="ColdFusion" Code="3000"/>
<fx:Object Product="JRun" Code="4000"/>
</mx:dataProvider>
</mx:DataGrid>
<!--Print Data Grid-->
<mx:DataGrid id="myDataGridPrint" visible="false" includeInLayout="false"/>
<mx:Button id="myButton"
label="Print"
click="doPrint();"/>
</mx:VBox>
</s:Application>
希望这可能会有所帮助...