diff --git a/README.md b/README.md index b9125b2..3dd54e4 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/ZplPrinter.zip b/ZplPrinter.zip index fd12801..39fb408 100644 Binary files a/ZplPrinter.zip and b/ZplPrinter.zip differ diff --git a/ZplPrinter/js/background.js b/ZplPrinter/js/background.js index 0caabc6..b8583e6 100644 --- a/ZplPrinter/js/background.js +++ b/ZplPrinter/js/background.js @@ -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', diff --git a/ZplPrinter/js/main.js b/ZplPrinter/js/main.js index a62252a..b2664a4 100644 --- a/ZplPrinter/js/main.js +++ b/ZplPrinter/js/main.js @@ -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,7 +155,9 @@ function startTcpServer() { chrome.sockets.tcpServer.onAccept.addListener(function (clientInfo) { chrome.sockets.tcp.getInfo(clientInfo.clientSocketId, function (socketInfo) { clientSocketInfo = socketInfo; - chrome.sockets.tcp.setPaused(clientInfo.clientSocketId, false); + chrome.sockets.tcp.update(clientInfo.clientSocketId,{bufferSize: parseInt(configs.bufferSize) }, function(){ + chrome.sockets.tcp.setPaused(clientInfo.clientSocketId, false); + }); }); }); } else { diff --git a/ZplPrinter/main.html b/ZplPrinter/main.html index 9023b90..1bd88d6 100644 --- a/ZplPrinter/main.html +++ b/ZplPrinter/main.html @@ -131,8 +131,15 @@
- + +
+
+ Buffer + + B +
+