2013-04-22 114 views
0

我必須允許用戶通過我的應用程序進行打印。我使用Flash Builder 4.5.1ios打印通過flex/flash builder移動應用程序

這裏創建應用程序適用於iOS是它的代碼: -

<?xml version="1.0" encoding="utf-8"?> 
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView"> 
    <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 
      { 
       // Create an instance of the FlexPrintJob class. 

        var printJob = new FlexPrintJob(); // calls the dialog 

        if(printJob.start()) // Starts when the user presses ok 
        { 

         printJob.addObject(dashPreview,FlexPrintJobScaleType.MATCH_WIDTH); // the object you want to add, and the scaling you want to apply 
         printJob.send(); // Send everything to the printers.   
        } 
      } 
     ]]> 
    </fx:Script> 

    <s:Label id="dashPreview" x="334" y="110" text="naveed mansuri"> 

    </s:Label> 

    <s:Button id="myButton" x="19" y="215" width="729" label="Print" click="doPrint();"> 

    </s:Button>  
</s:View> 

但是煥我運行此應用程序和clicl上打印,我得到了以下錯誤的錯誤對話框: -

Error: Error #2055: The print job could not be started. at Error$/throwError() 
    at flash.printing::PrintJob/start() 
    at mx.printing::FlexPrintJob/start()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\printing\FlexPrintJob.as:200] 
    at views::PrintHomeView/doPrint()[C:\Documents and Settings\naveedmansuri\Adobe Flash Builder 4.5\Print\src\views\PrintHomeView.mxml:20] 
    at views::PrintHomeView/__myButton_click()[C:\Documents and Settings\naveedmansuri\Adobe Flash Builder 4.5\Print\src\views\PrintHomeView.mxml:34] 

此代碼有什麼問題?打印類是不是移動優化? 我必須只打印標籤文本。 真誠的請求讓我擺脫這個問題。我很快就會爲此應用程序發佈一個發佈日期。

回答

0

LiveDocs

移動瀏覽器支持:此類不移動 瀏覽器支持。

AIR配置文件支持:此功能支持所有桌面 操作系統,但它不支持在移動設備上或AIR for TV設備。您可以使用 PrintJob.isSupported屬性在運行時測試支持。有關跨多個配置文件的API支持的更多 信息,請參閱AIR配置文件支持。

在移動設備上打印的唯一方法是通過AIR本機擴展。

+0

你能告訴我,我必須使用AIR本機擴展嗎? – 2013-04-23 07:10:37

+0

不,對不起。我上週正在尋找一個,但無法找到一個。不過,這將是唯一的方法。 – 2013-04-23 11:19:37

+0

好的。 Thanx雖然 – 2013-04-23 12:53:34