Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

Serious Problem with Adobe Air printing - Html-AJAX developer

$
0
0

hi Guys,

 

It is my first commercial project and I am really disappointed with adobe air so far.

I have played a lot with adobe air to work with Print functionality but damn all is vain.

 

I need a big HELP from community and this is my final hope. If not I will leave Development in Adobe Air.

 

I am working on adobe air HTML-Ajax application. What it does, gets the order details from server and then print the order details.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <meta name="generator" content=
        "HTML Tidy, see www.w3.org" />
        <title>Pizza Smart Order Prints</title>
        <link href="sample.css" rel="stylesheet" type="text/css"/>
        <script type="text/javascript" src="lib/air/AIRAliases.js"></script>
         <script type="text/javascript" src="lib/jquery/jquery-1.3.2.min.js"></script>
        <script type="text/javascript">
            function doPrintAir()
            {
                   var pjob = new window.runtime.flash.printing.PrintJob;
   if ( pjob.start() )
                {
                    var poptions = new window.runtime.flash.printing.PrintJobOptions;
                    poptions.printAsBitmap = true;
                    try
                    {
                    
                        pjob.addPage(window.htmlLoader, null, poptions);
                        pjob.send();
                        //alert("PrintJob start");
                        //$("#board").append(t.'3');
                    }
                    catch (err)
                    {
                        alert("exception: " + err);
                    }
                }
                else
                {
                   // alert("PrintJob couldn't start");
                }
            }
        </script>
        <script language=javascript>
clock();
var t=0;
var timer;
function clock()
  {
                     // goes and check for the orders posted
                    if(timer)
                    {
                        clearTimeout(timer);
                        //alert(timer);
                        //t=0;
                    }
                    t++;
                    $.ajax({
                           type: "POST",
                           url: "http://xxxxxxxxxxxxxxr/air/db.php",
                           data: "id=;908fHtiIl",
                           success: function(msg){
                             $('#main_window').html("");
                              $('#main_window').html("Loading..");
                             // alert( $('#main_window').html() );
                             if (msg == "nothing") {
                                 $('#main_window').html(msg);
                             }
                             else if(msg !=""){
                                $('#main_window').html(msg);
                                doPrintAir();
                                //$("#board").append(msg);
                                
                             }
                             else
                             {
                                
                             }
                           }
                         });
                        
                         timer=setTimeout(clock,5000);
  }
</script>
    </head>
    <body>
        <table width="200" border="1">
  <tr>
    <td><span class="style1">Pizza Application</span></td>
  </tr>
  <tr>
    <td>
        <div id="main_window">
            "Loading.."
        </div>
        <div id="board"></div>
    </td>
  </tr>
</table>
    </body>
</html>

 

 

Is there any way to just pass the text to print ? instead of html page ?


Viewing all articles
Browse latest Browse all 21156

Trending Articles