{"action":"created","issue":{"url":"https://api.github.com/repos/qzind/tray/issues/392","repository_url":"https://api.github.com/repos/qzind/tray","labels_url":"https://api.github.com/repos/qzind/tray/issues/392/labels{/name}","comments_url":"https://api.github.com/repos/qzind/tray/issues/392/comments","events_url":"https://api.github.com/repos/qzind/tray/issues/392/events","html_url":"https://github.com/qzind/tray/issues/392","id":387811876,"node_id":"MDU6SXNzdWUzODc4MTE4NzY=","number":392,"title":"Printing mixed content in the correct order","user":{"login":"lorro","id":977617,"node_id":"MDQ6VXNlcjk3NzYxNw==","avatar_url":"https://avatars2.githubusercontent.com/u/977617?v=4","gravatar_id":"","url":"https://api.github.com/users/lorro","html_url":"https://github.com/lorro","followers_url":"https://api.github.com/users/lorro/followers","following_url":"https://api.github.com/users/lorro/following{/other_user}","gists_url":"https://api.github.com/users/lorro/gists{/gist_id}","starred_url":"https://api.github.com/users/lorro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lorro/subscriptions","organizations_url":"https://api.github.com/users/lorro/orgs","repos_url":"https://api.github.com/users/lorro/repos","events_url":"https://api.github.com/users/lorro/events{/privacy}","received_events_url":"https://api.github.com/users/lorro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-05T15:32:37Z","updated_at":"2018-12-05T17:54:16Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI'm encountering a new issue with the following. I want to print an order receipt with a logo, the order details in html and a QR code that contains the order number. In that order. The problem is the QR code get printed before everything else in the header, while I want it displayed in the footer.\r\n\r\nI've got it set up like this\r\n```js\r\n qz.print(config, getReceiptLogo())\r\n   .then(() => {\r\n     return qz.print(config, getReceiptHtml(this.receipt))\r\n    })\r\n    .then(() => {\r\n      return qz.print(config, getReceiptQR(this.receipt))\r\n     })\r\n```\r\n\r\n```js\r\nexport function getReceiptLogo () {\r\n  return [\r\n    `\\x1B\\x61\\x31`, // center align\r\n    {\r\n      type: 'raw',\r\n      format: 'image',\r\n      data: 'logo-receipt.jpg',\r\n      options: {\r\n        language: 'ESCPOS',\r\n        dotDensity: 'double'\r\n      }\r\n    }\r\n  ]\r\n}\r\n\r\nexport function getReceiptHtml (receipt) {\r\n  return [{\r\n    type: 'pixel',\r\n    format: 'html',\r\n    flavor: 'plain',\r\n    data: 'this contains a bunch of html'\r\n  }]\r\n}\r\n\r\nexport function getReceiptQR (receipt) {\r\n  const qr = receipt.nr\r\n\r\n  // QR Dot Size\r\n  const dots = `\\x05`\r\n  // QR proprietary size calculation\r\n  const size1 = String.fromCharCode(qr.length + 3)\r\n  const size0 = `\\x00`\r\n\r\n  // Create the QR Code\r\n  const data = [\r\n    `\\x1B\\x61\\x31`, // center align\r\n    // <!-- BEGIN QR DATA -->\r\n    `\\x1D\\x28\\x6B\\x04\\x00\\x31\\x41\\x32\\x00`,\r\n    `\\x1D\\x28\\x6B\\x03\\x00\\x31\\x43${dots}`,\r\n    `\\x1D\\x28\\x6B\\x03\\x00\\x31\\x45\\x30`,\r\n    `\\x1D\\x28\\x6B${size1}${size0}\\x31\\x50\\x30${qr}`,\r\n    `\\x1D\\x28\\x6B\\x03\\x00\\x31\\x51\\x30`,\r\n    `\\x1D\\x28\\x6B\\x03\\x00\\x31\\x52\\x30`\r\n    // <!-- END QR DATA -->\r\n  ]\r\n\r\n  return data\r\n}\r\n```\r\n\r\nI've also tried this as setup as I read it was part of the API in version 2.1:\r\n```js\r\nqz.print(config, [getReceiptLogo(), getReceiptHtml(this.receipt), getReceiptQR(this.receipt)])\r\n```\r\n\r\nBut that just prints the QR in the header and a bunch of unprocessed html :)\r\n\r\nDo you guys have any idea what I could be doing wrong?\r\n\r\nThanks!\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/qzind/tray/issues/comments/444580086","html_url":"https://github.com/qzind/tray/issues/392#issuecomment-444580086","issue_url":"https://api.github.com/repos/qzind/tray/issues/392","id":444580086,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NDU4MDA4Ng==","user":{"login":"lite1979","id":3408749,"node_id":"MDQ6VXNlcjM0MDg3NDk=","avatar_url":"https://avatars0.githubusercontent.com/u/3408749?v=4","gravatar_id":"","url":"https://api.github.com/users/lite1979","html_url":"https://github.com/lite1979","followers_url":"https://api.github.com/users/lite1979/followers","following_url":"https://api.github.com/users/lite1979/following{/other_user}","gists_url":"https://api.github.com/users/lite1979/gists{/gist_id}","starred_url":"https://api.github.com/users/lite1979/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lite1979/subscriptions","organizations_url":"https://api.github.com/users/lite1979/orgs","repos_url":"https://api.github.com/users/lite1979/repos","events_url":"https://api.github.com/users/lite1979/events{/privacy}","received_events_url":"https://api.github.com/users/lite1979/received_events","type":"User","site_admin":false},"created_at":"2018-12-05T17:54:16Z","updated_at":"2018-12-05T17:54:16Z","author_association":"CONTRIBUTOR","body":"@lorro \r\n\r\n@tresf and I wrote this sample a while ago (on 2.0), but the concept should be the same;\r\n\r\nESCP (ESCPOS in this case) content will race ahead of HTML content if processed concurrently, as JavaFX has to process the HTML, then the Epson driver has to process the raster image, but the ESCP will go straight to the printer and get processed by the printer's firmware.\r\n\r\nhttps://gist.github.com/lite1979/30cb2c6d5ea50fd8a59a6effe837e882\r\n"}}
{"actor":{"display_login":"lite1979"}}