Jump to content

The right place for APPLET


dionel1969

Recommended Posts

Hello again:

 

May be the question is not good explained. I have a POS App and I don't use any Report Tools for printing, just send Printing Command (normally EPSON/ESC commands) directly to printer, and for this in web mode I will use jZebra Applet. I tested it and works very well, also it include other possibilities like print PDF. So for some applications it is very good, at least for me. The POS is almost done, except for implementation of printing functionality that is waiting for this.

Link to comment
Share on other sites

Have you tried putting Applet code in a TUniHTMLFrame?

 

1- I tested it now with HTMLFrame and show an error more or less: Object A80 not found.

 

2- I tested it generating html to a file and using URLFrame and it works well.

 

The file for testing was this:

 


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
 <title>Pagina de Prueba</title>
 <script>

     function print()
      {
        var applet = document.jZebra;
        if (applet != null)
          {
           // Send characters/raw commands to applet using "append"
           // Hint:  Carriage Return = \r, New Line = \n, Escape Double Quotes= \"
           applet.append("Linea 1 \n");
           applet.append("Linea 2 \n");
           applet.append("Linea 3 \n");
           applet.append(" \n");
           applet.append(" \n");
           applet.append(" \n");
           applet.append("Linea Ultima \n");
           applet.setEndOfDocument("P1\n");

           // Send characters/raw commands to printer
           applet.print();
          }
         else
          {
           alert("Applet not loaded!");
          }
      }

 </script>
</head>

<body onLoad="print()">
  <applet name="jZebra" code="jzebra.PrintApplet.class" archive="./jzebra.jar" width="100" height="100">
     <param name="printer" value="zebra">
     <!-- <param name="sleep" value="200"> -->
  </applet><br><br>

</body>
</html>


Link to comment
Share on other sites

Note: the use of OnLoad

 

<body onLoad="print()">
  <applet name="jZebra" code="jzebra.PrintApplet.class" archive="./jzebra.jar" width="100" height="100">
     <param name="printer" value="zebra">
  </applet><br><br>
</body>

 

may be this is the reason for an error in html frame, or may be not. The problem is that sometime is good to show a preview, in some other applications, but in this case it is necessary to print directly immediately.

Link to comment
Share on other sites

A little more about this (APPLETS):

 

In this case I use applet for direct printing, but in some Laboratories Applications or for Industries there are a lot of Applets designed and running for communication between computer and other devices: lab's measures tools and so on. So, if will possible to include the use of applets in main web page, would be good for many people. I don't know if it possible for you in the generation of html include this. It is just a comment for you.

Link to comment
Share on other sites

Problem here is the OnLoad event. It won't bu called in a uniGUI app.

You must manually call it in one of the Ext JS events.

 

I will check this, because it works but I have to reload the frame right clicking the mouse. In the case of the POS I'm developing it is necessary to print out immediately, to print with Preview is an option not necessary in this case, even is an option not desired for people who works with POS.

 

May be I will try with Timer to PrintOut first, and later to close the form. Let me see.

Link to comment
Share on other sites

I could not print out the ticket of POS. If I "reload frame" the ticket is printed out, but I did not find a way to call it (

function PrintTicket();

) from Button, Timer, etc...

 

This is my test code:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
 <title>Pagina de Prueba</title>
 <script>

     function print()
      {
        var applet = document.jZebra;
        if (applet != null)
          {
           // Send characters/raw commands to applet using "append"
           // Hint:  Carriage Return = \r, New Line = \n, Escape Double Quotes= \"
           applet.append("Linea 1 \n");
           applet.append("Linea 2 \n");
           applet.append("Linea 3 \n");
           applet.append(" \n");
           applet.append(" \n");
           applet.append(" \n");
           applet.append("Linea Ultima \n");
           applet.setEndOfDocument("P1\n");

           // Send characters/raw commands to printer
           applet.print();
          }
         else
          {
           alert("Applet not loaded!");
          }
      }

 </script>
</head>

<body onLoad="print()">
  <applet name="jZebra" code="jzebra.PrintApplet.class" archive="jzebra.jar" width="100" height="100">
     <param name="printer" value="zebra">
     <!-- <param name="sleep" value="200"> -->
  </applet><br><br>

</body>
</html>


 

How can I solve this issue with other tools????

Link to comment
Share on other sites

I need to clarifying something. What code could be inside HTMLFrame? A whole HTML Page code from <html> to </html>??? or just a part of it????

 

I put the code in the above post inside html frame that is inside a MainForm (with not inheritance) and the app just show the loading mask interminably and never loaded the main form.

 

NOTICE: For me it is a VERY IMPORTANT ISSUE: Print POS Tickets directly without Preview or Button's Clicking.

Link to comment
Share on other sites

I change back HTMLFrame with URLFrame with this code:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
 <title>Pagina de Prueba</title>
 <script>

     function PrintTicket()
      {
        var applet = document.jZebra;
        if (applet != null)
          {
           // Send characters/raw commands to applet using "append"
           // Hint:  Carriage Return = \r, New Line = \n, Escape Double Quotes= \"
           applet.append("Linea 1 \n");
           applet.append("Linea 2 \n");
           applet.append("Linea 3 \n");
           applet.append(" \n");
           applet.append(" \n");
           applet.append(" \n");
           applet.append("Linea Ultima \n");
           applet.setEndOfDocument("P1\n");

           // Send characters/raw commands to printer
           applet.print();
          }
         else
          {
           alert("Applet not loaded!");
          }
      }

 </script>
</head>

<body onLoad="PrintTicket()">
  <applet name="jZebra" code="jzebra.PrintApplet.class" archive="jzebra.jar" width="100" height="100">
     <param name="printer" value="zebra">
     <!-- <param name="sleep" value="200"> -->
  </applet><br><br>

 <div align="center">
  <form><input type="button" onclick="PrintTicket()" value="Imprimir Ticket"></form> 
 </div>
</body>
</html>

 

and using button "Imprimir Ticket" it works well. I press ENTER key in the address bar the app (test) reloads and it prints directly without using Button. So, if will be possible to call a method like: URLFrame1.Reload() I think it will possible to print directly without using button for this.

Link to comment
Share on other sites

Please send a simple test case with all necessary files.

 

Ok, this is a simple test with URLFrame that works if:

 

1- You click the button in the html

 

2- Reload frame

 

3- Reload whole app (from explorer address bar)

 

Note: If you replace the URLFrame with HTMLFrame and put scripts of Applet definition you will see the behavior I describe here in above posts.

 

PS: You can obtain any additional documentation from: http://code.google.com/p/jzebra/

Prueba para los Applets.rar

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...