I have to allow user to print through my application. I am creating application for ios using flash builder 4.5.1
Here is the code for it:-
<?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>
But Whan I run this application and clicl on print, I got following error box of errors:-
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]
What wrong in this code? Is print class is not mobile optimized? I have to print only a label text. Sincere request to get me out of this issue. I have a release date soon for this application.