0
我也试图用Ruby编写这个代码。所以Ruby中的一个例子会很棒!在ZPL中发送发布请求时,参数来自哪里?
我也试图用Ruby编写这个代码。所以Ruby中的一个例子会很棒!在ZPL中发送发布请求时,参数来自哪里?
我不知道哪些参数你要找的ZPL的HTTP参数等打印像使用HTTP POST到斑马打印机ZPL目录列表,它的格式应为:
POST/pstprnt HTTP/1.1 <CR><LF>
的Content-Length:9 <CR><LF><CR><LF>
^^ XA^WD XZ
我没有红宝石的例子,但在JavaScript中,它看起来是这样的:
function print_this(zpl, ip_addr)
{
var output = document.getElementById("output");
var url = "http://"+ip_addr+"/pstprnt HTTP/1.1";
var method = "POST";
var async = true;
var request = new XMLHttpRequest();
request.onload = function() {
var status = request.status; // HTTP response status, e.g., 200 for "200 OK"
var data = request.responseText; // Returned data, e.g., an HTML document.
output.innerHTML = "Status: " + status + "<br>" + data;
}
request.open(method, url, async);
request.setRequestHeader("Content-Length", zpl.length);
// Actually sends the request to the server.
request.send(zpl);
}
你能提供一些更多详情?你在使用ZebraLink SDK吗? – 2014-11-07 14:10:57