我必须允许用户通过我的应用程序进行打印。我正在使用 flash builder 4.5.1 为 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]
这段代码有什么问题?打印类不是移动优化的吗?我只需要打印标签文本。真诚的请求让我摆脱这个问题。我很快就会有这个应用程序的发布日期。