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]
此代码有什么问题?打印类是不是移动优化? 我必须只打印标签文本。 真诚的请求让我摆脱这个问题。我很快就会为此应用程序发布一个发布日期。
你能告诉我,我必须使用AIR本机扩展吗? – 2013-04-23 07:10:37
不,对不起。我上周正在寻找一个,但无法找到一个。不过,这将是唯一的方法。 – 2013-04-23 11:19:37
好的。 Thanx虽然 – 2013-04-23 12:53:34