Maybe not the most beautiful solution only this is the way I do it.
First I create a file using php with a unique code.
<php code>
$myFile = "./barcodes/" . $barcode . ".txt";
//$myFile = "./barcodes/1.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "A250,5,0,3,1,1,N,\"".$firstname. " ".
$lastname."\"\n";
fwrite($fh, $stringData);
$stringData = "A250,30,0,3,1,1,N,\"".$company."\"\n";
fwrite($fh, $stringData);
$stringData = "B250,60,0,1,3,7,100,B,\"".$barcode."\"\n";
fwrite($fh, $stringData);
$stringData = "A250,195,0,3,1,1,N,\"Room number: " .$room_nr .
"\"\n";
fwrite($fh, $stringData);
$stringData = "A250,215,0,3,1,1,N,\"Valid until: " .$end_date .
"\"\n";
fwrite($fh, $stringData);
$stringData = "P1\n";
fwrite($fh, $stringData);
$stringData = "N\n";
fwrite($fh, $stringData);
fclose($fh);
<end php code?>
<html>
<tr class="text_12">
<td width="960" colspan="3" align="center">
<FORM NAME="test">
<H2>
<INPUT TYPE="TEXT" NAME="barcode" value="<?php echo $barcode; ?>"
style="width:960px; height:25px"><BR>
<br />
<INPUT TYPE="Button" Value="PRINT BARCODE"
onClick="printbarcode(this.form)" style="width:960px; height:50px;"">
</H2>
</FORM>
<applet name="jZebra" code="jzebra.RawPrintApplet.class"
archive="jzebra.jar" width="0" height="0">
<param name="printer" value="zebra">
<!-- <param name="sleep" value="200"> -->
</applet>
</td>
</tr>
</html>
In the script part:
function printbarcode(frm) {
var applet = document.jZebra;
if (applet != null) {
applet.appendFile("
http://xx-xx.com/ticket/admin/barcodes/" +
frm.barcode.value + ".txt");
applet.print();
}
window.location.replace(window.location.pathname);
// if (frm.barcode.value == "")
// alert("Lege barcode geprint")
// else
// alert("Barcode geprint")
}