Print Barcode using TSC TTP-244 Plus

2,919 views
Skip to first unread message

david Novianto

unread,
Aug 29, 2013, 5:54:58 AM8/29/13
to jzebra...@googlegroups.com
Hi all, 

When i found this group, and i was reading what i need but i can't found to my problem. My project using PHP and my barcode printer with TSC TTP-244 Plus.  When i build my project, i just printing using local and no problem. But when using server, i got the problem how to print directly from server to client. My code is : 

<?php 
  
          echo "This is a TSCActiveX.Dll test in PHP 5.0.";
  $TSCObj  = new COM ("TSCActiveX.TSCLIB") or die("Unable to open COM object");
  $TSCObj->ActiveXopenport("TSC TTP-244 Plus");   
          $TSCObj->ActiveXsetup("53", "30", "5", "12", "0", "36", "0");
  $TSCObj->ActiveXclearbuffer(); 
          $TSCObj->ActiveXbarcode("12", "56", "128", "75", "1", "0", "2", "2", "123456789AAAAA");
  $TSCObj->ActiveXprintlabel("1","1");
          $TSCObj->ActiveXcloseport();

       ?>
When ActiveXopenport using specify the UNC path and printer name. I don't know how to replace because my client using internet not intranet or LAN. When i was reading " PHP Printing Example", i have a idea to replace with direct print. My question :
1. jZebra support for TSC TTP-244 Plus ? I know for description, jZebra support for Zebra printer barcode. But i hope maybe, anyone using jZebra for TSC printer.
2. Can i using direct print using java script using TSC Printer ? 

Thank you for reading my problem. 

Tres Finocchiaro

unread,
Aug 29, 2013, 10:29:25 AM8/29/13
to jZebra users
1. jZebra support for TSC TTP-244 Plus ? I know for description, jZebra support for Zebra printer barcode. But i hope maybe, anyone using jZebra for TSC printer.
Yes, the TSC TTP-244 Plus should be supported.   According to the product sheet found here, the TSC TTP-244 Plus supports Zebra and Eltron language emulation.  This suggests ZPL and EPL support.

 
2. Can i using direct print using java script using TSC Printer ? 
 If you are printing using PHP from the server, then no, not currently.  jZebra is an applet that runs on the client-side, there is no server version available at this time.  In order for you to use jZebra you would need to embed a Java Applet in your web page that loads on the clients.  This the only configuration supported currently.

The advantage to running on the client is the printers can be directly attached to the PC via USB, Parallel, Serial as well as the existing Network connectivity I suspect you are using.

Please try sample.html and click the "Print EPL" or "Print ZPL" buttons to test the functionality from the client.

-Tres

david Novianto

unread,
Aug 30, 2013, 6:30:56 AM8/30/13
to jzebra...@googlegroups.com
Thank you Tres, it's work when i try using EPL. But i'm had a problem for applet.append(). Here my coding : 
<?php
$barcode = 'N 
  q508
  Q240,24
  B112,40,0,1,2,1,40,B,"04A020213001140"
  P1,1';
?>

<script type="text/javascript">
      function printx() {
         var applet = document.jzebra;
         if (applet != null) {
applet.append(<?php echo $barcode; ?>);
applet.print(); // send commands to printer
}
   monitorPrinting();
      }
</script> 

OR

<?php
$barcode = "04A020213001140";
?>

      function printx() {
         var applet = document.jzebra;
         if (applet != null) {
applet.append("\nN\n");            
applet.append("q508\n");
applet.append("Q240,24\n");
applet.append("B112,40,0,1,2,1,40,B,\" <?php echo $barcode; ?> \"\n");
applet.append("\nP1,1\n");
applet.print(); // send commands to printer
}
   monitorPrinting();
      } 

My coding doesn't working. Could you show how to work ? 
Thank you.

Tres Finocchiaro

unread,
Aug 30, 2013, 10:46:07 AM8/30/13
to jZebra users
@David:

The code should work.  Does barcode have any extra newline characters in it?

It can be tricky when you're writing JavaScript on the fly like that (it can break the entire script if a newline or incorrectly terminated string shows up... ,So for that reason I usually recommend using AJAX and JSON to retrieve your values if that is an option.

Another option is to use base64 and append using that, i.e. append64("<?php echo $base64data; ?>");

-Tres


--
--
To unsubscribe from this group, send email to jzebra-users...@googlegroups.com
 
http://code.google.com/p/jzebra
 
---
You received this message because you are subscribed to the Google Groups "jZebra users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jzebra-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
- Tres.Fin...@gmail.com

James Reason

unread,
Aug 30, 2013, 10:59:50 AM8/30/13
to jzebra...@googlegroups.com

Hi David,

 

Please try the following and see if that works:

 

      function printx() {

         var applet = document.jzebra;

         if (applet != null) {

applet.append("N\n");            

applet.append("q508\n");

applet.append("Q240,24\n");

applet.append("B112,40,0,1,2,1,40,B,\" <?php echo $barcode; ?> \"\n");

applet.append("P1\n");

david Novianto

unread,
Sep 3, 2013, 6:57:30 AM9/3/13
to jzebra...@googlegroups.com
Hi Tres, 

My barcode does not any extra newline. I just only following the sample. Can u give a sample using AJAX and JSON to retrieve my value ? because i'm newbie for Java Script and PHP. Thank you for helping me. 

David N 

Hi James,

I already following your code but it doesn't work. Maybe do u have a idea to the other ways ? I don't how to debug Java Script. Thank You for helping me.

David N 

Tres Finocchiaro

unread,
Sep 3, 2013, 4:08:28 PM9/3/13
to jZebra users
@David:  The easiest way to debug JavaScript (from my experience) is to install Google Chrome web browser and Right Click --> Inspect Element on the web page.

If you see a red X in the bottom right of the browser, you likely have a JavaScript syntax issue.

If you are still learning JavaScript, you will want to learn a bit more about asynchronous JavaScript and JSON before digging into that code.  jQuery's JSON tools are a good place to start, but this help is outside of the scope of the project and should be taken offline.

-Tres
Reply all
Reply to author
Forward
0 new messages