QZ-Print Java Applet中的调用函数在PHP中不起作用
Calling Functions in QZ-Print Java Applet doesn't work in PHP
我正在尝试使用Java插件从浏览器打印到原始打印到票据打印机。我在HTML和Javascript中编写了一个测试程序,工作正常,但现在我试图将代码转移到php脚本中,以便在更大的应用程序中打印门票。每当我从应用程序调用函数时,我都会在firefox调试中遇到这种错误。" TypeError:求出。findPrinter不是一个函数"。
我将原始测试程序的扩展名从。html更改为。php,我现在也在那里收到错误。
java中的任何函数都以"qz"开头。"
这里的插件供参考https://code.google.com/p/jzebra/wiki/TutorialWebApplet
我想这是我不知道php的东西,因为它可以作为一个。html文件,但我已经包括了整个脚本。php从xampp运行。
谢谢你的宝贵时间。
<html>
<head><title>Receipt Test</title>
<script type="text/javascript" src="js/deployJava.js"></script>
<script type="text/javascript">
deployQZ();
function deployQZ() {
var attributes = {id: "qz", code:'qz.PrintApplet.class',
archive:'qz-print.jar', width:1, height:1};
var parameters = {jnlp_href: 'qz-print_jnlp.jnlp',
cache_option:'plugin', disable_logging:'false',
initial_focus:'false'};
if (deployJava.versionCheck("1.7+") == true) {}
else if (deployJava.versionCheck("1.6+") == true) {
attributes['archive'] = 'jre6/qz-print.jar';
parameters['jnlp_href'] = 'jre6/qz-print_jnlp.jnlp';
}
deployJava.runApplet(attributes, parameters, '1.5');
}
function countSpace(product, price, section) {
var spaceNeeded = (section - product.length - price.toString().length);
var spaces = "";
for(i=0; i < spaceNeeded; i++) {
spaces += " ";
}
return (product + spaces + price);
}
function findPrinter() {
// Searches for locally installed printer with "zebra" in the name
qz.findPrinter("zebra");
// Hint: Carriage Return = 'r, New Line = 'n, Escape Double Quotes= '"
var ticketTime = new Date();
var singleLine = "'n------------------------------------------'n";
var doubleLine = "'n=========================================='n";
var product = ["Mirdan Tuzlama", "Suckuklu Pide" ];
var price = [8.00, 8.00];
var prodCharLength = 37;
var finCharLength = 42;
var subTotal = {name:"Subtotal", value:0};
for(i=0;i<product.length;i++) {
subTotal.value += price[i];
}
var tax = {name:"Tax", value:((20/100)*subTotal.value)};
var total = {name:"Total", value:(subTotal.value-tax.value)};
var ticketEnd = " Thank You'n'n'n'n'n'n'n'n'n'n'n'n'n'n";
var productSec = "";
tax.value = 0 - tax.value;
for(j=0;j<product.length;j++) {
var priceloop = price[i];
productSec += (" - 1 " + countSpace(product[j], price[j],prodCharLength));
if (j<=(product.length-2)){
productSec += "'n"
}
}
qz.append("'nDate:" + ticketTime.getDate() + "/"
+ (ticketTime.getMonth()+1) + "/"
+ ticketTime.getFullYear()
+ "'nTime:" + ticketTime.getHours() + ":"
+ ticketTime.getMinutes()
+ "'nTable: B10'nTicket No:2"
//+ singleLine + " - 1 " + product1 +" 8.00'n - 1 " + product1 +" 8:00"
+ singleLine + productSec
+ doubleLine + countSpace(subTotal.name, subTotal.value,finCharLength)
+ ''n' + countSpace(tax.name, tax.value,finCharLength)
+ ''n' + countSpace(total.name, total.value,finCharLength)
+ doubleLine + ticketEnd);
qz.print();
}
</script>
<body>
<input type="button" onClick="findPrinter()" value="Print ESCP" /><br />
</body>
" TypeError:求出。findPrinter不是一个函数"
-
在QZ"Tray"1.9(桌面应用程序)中,
qz.findPrinter(...)
被定义为preemptive
函数,由qz-websocket.js
创建,必须包含在您的项目中才能暴露。
如果您没有包含qz-websocket.js
,则会出现此消息 -
在QZ"Print"1.9 (Java Applet)和更早的版本中,
qz.findPRinter(...)
是通过使用Java LiveConnect调用的Java Applet暴露的,所以这是Applet未加载的标志。
如果您的applet没有正确加载,则会出现此消息
注意: 1.9既可以作为桌面应用程序又可以作为Java小程序。
弃用警告: 1.9及更早版本是EOL。QZ Tray 2.0及更高版本,API有明显变化。可以使用迁移指南。
- PHP邮件()不起作用
- 使用PHP插入HTML在JavaScript上不起作用
- AJAX 调用 PHP 不起作用
- PHP不起作用
- 基本的 AJAX 请求 Javascript/PHP 不起作用
- Ajax发布到PHP不起作用
- 通过javascript使用Ajax Post将Json传递给php不起作用
- 在函数中导入JavaScript.php不起作用
- 使用 JQuery AJAX 将值传递给 PHP 不起作用,数组混乱
- 将变量从 Ajax 传递到 PHP 不起作用
- 将 JavaScript 对象传递给 PHP 不起作用
- Ajax调用JS+PHP不起作用
- 简单的PHP不起作用
- Chrome上的HTML5画布和php不起作用
- 将Javascript变量传递给PHP不起作用
- Javascript生成PHP不起作用
- Javascript + PHP不起作用
- 元标记中的PHP不起作用
- JavaScript函数中的PHP不起作用
- 简单的jQuery + PHP不起作用