0

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.

Naveed Mansuri
  • 439
  • 1
  • 5
  • 13

1 Answers1

0

From the LiveDocs:

Mobile Browser Support: This class is not supported in mobile browsers.

AIR profile support: This feature is supported on all desktop operating systems, but it is not supported on mobile devices or AIR for TV devices. You can test for support at run time using the PrintJob.isSupported property. See AIR Profile Support for more information regarding API support across multiple profiles.

Only way to print on mobile devices is through an AIR Native Extension.

Josh
  • 8,079
  • 3
  • 24
  • 49