configurable tcp bufferSize, pdf fixes, v1.6

This commit is contained in:
sbinkert 2016-11-05 00:03:01 +01:00
parent c30c0eabfc
commit 3404824de1
5 changed files with 26 additions and 7 deletions

View File

@ -8,9 +8,13 @@ Printer emulator for zpl rendering engine. The emulator is based on the [labelar
## Release notes
### Version 1.6
* **Fix** PDF label export.
* **New** TCP input buffer size can be configure in settings.
### Version 1.5
* **New** Support to print multtiple labels in one request.
* **New** Support to print multiple labels in one request.
* **New** Optional setting to keep tcp connection alive.
### Version 1.4.1

Binary file not shown.

View File

@ -19,6 +19,7 @@ chrome.runtime.onInstalled.addListener(function (details) {
unit: '1',
host: '127.0.0.1',
port: '9100',
bufferSize: '4096',
keepTcpSocket: false,
saveLabels: false,
filetype: '1',

View File

@ -28,9 +28,16 @@ $(document).ready(function () {
for (var i in zpls) {
var zpl = zpls[i];
if (zpl != "") {
zpl = zpl + "^XZ";
if(!(!zpl || !zpl.length)) {
zpl += "^XZ";
}
if (configs['saveLabels']) {
if (configs['filetype'] == '2') {
savePdf(zpl, configs.density, width, height);
}
}
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://api.labelary.com/v1/printers/{0}dpmm/labels/{1}x{2}/0/'.format(configs.density, width, height), true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
@ -41,8 +48,6 @@ $(document).ready(function () {
if (configs['saveLabels']) {
if (configs['filetype'] == '1') {
saveLabel(blob, 'png');
} else {
savePdf(zpl, configs.density, width, height);
}
}
var size = getSize(width, height)
@ -150,9 +155,11 @@ function startTcpServer() {
chrome.sockets.tcpServer.onAccept.addListener(function (clientInfo) {
chrome.sockets.tcp.getInfo(clientInfo.clientSocketId, function (socketInfo) {
clientSocketInfo = socketInfo;
chrome.sockets.tcp.update(clientInfo.clientSocketId,{bufferSize: parseInt(configs.bufferSize) }, function(){
chrome.sockets.tcp.setPaused(clientInfo.clientSocketId, false);
});
});
});
} else {
socketId = undefined;
toggleSwitch('.btn-toggle');

View File

@ -133,6 +133,13 @@
<table>
<tr>
<td>
<div class="input-group" style="padding-right: 10px;">
<span class="input-group-addon">Buffer</span>
<input id="bufferSize" name="bufferSize" class="form-control" placeholder="4096" required type="number" min="1024">
<span class="input-group-addon">B</span>
</div>
</td>
<td width="50%">
<div class="checkbox" style="padding-right: 10px;">
<label>
<input id="ckb-keep-tcp-socket" type="checkbox" />