【问题标题】:how to to print a bill (small size pages) in a AIR application如何在 AIR 应用程序中打印账单(小尺寸页面)
【发布时间】:2012-05-14 15:56:46
【问题描述】:

我正在为沙龙创建一个 AIR 应用程序,我想以小页打印发票。

我怎样才能实现这些???请帮帮我

谢谢。

【问题讨论】:

  • 请定义“小页面”是什么意思?通常我建议人们将打印数据发送到服务器,然后返回 PDF 用于打印目的。
  • 小页面表示250*500

标签: apache-flex printing air invoice


【解决方案1】:

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>

希望这可能会有所帮助...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-10-29
    • 2011-01-15
    • 2018-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-28
    • 1970-01-01
    相关资源
    最近更新 更多