qzind / tray

Browser plugin for sending documents and raw commands to a printer or attached device.

Home Page:https://qz.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support config, data substitutions client-side

tresf opened this issue · comments

A growing complaint of clients is the inability to control certain printer preferences when the website developer is reluctant to do so.

Use-cases:

  • Brother QL 1100 prefers { size: { width: 4.08, height: 6.47 }} when combined with the supplied DK-1247 labels.
    #1212
    • Symptom: Cannot print
  • Rollo printer prefers{ size: { width: 100, height: 150 }, units: 'mm' } over the more common 4x6 size.
    • Symptom: Extra unnecessary pages when printing

... in both cases, the customer is unable to remedy the situation because of reluctance of the website developer to add custom label sizes.

Proposed solution:

  • The proposed solution is to add a JSON mapping file called substitutions.json that allows the JSON messages from the websocket to be intercepted and overridden prior to printing.

Proposed JSON format:

[{
 "use": {
  "config": { "size": ... },
  "data": { "options": ... }
 },
 "for": {...}
}]
  • Prior to processing the JSON received from the websocket, QZ Tray will look for for in the sent data and replace it with use.
  • The operation will be logged to the QZ Tray console to ensure that this operation is well-known for diagnostic purposes.
  • The substitutions.json file will be removed (or renamed) on reinstall to ensure a vanilla experience between reinstalls.

TODO:

  • Ensure it does not break signature calculation.
  • Implications of allowing more copies, changing data (e.g. tickets)