title: Creating barcodes using JSBarCode
body: <p>I am using <a href="https://www.npmjs.com/package/jsbarcode" rel="nofollow noreferrer">JSBarCode</a> to try and generate barcodes for assets. I need to be able to create a static barcode then I think I can get the dynamic part myself. My code so far is direct copy from the docs found on the link above. I would think the docs would give a working example to base my code off. Maybe I did the code wrong, I have the code below and I have done the NPM installs already for jsbarcode and canvas.</p>
  
  <p>Server side code:</p>
  
  <pre><code>var JsBarcode = require('jsbarcode');
  var Canvas = require("canvas");
  
  var canvas = new Canvas();
  JsBarcode(canvas, "Hello");
  JsBarcode(".barcode").init();
  </code></pre>
  
  <p>HTML: </p>
  
  <pre><code>&lt;svg class="barcode"
    jsbarcode-format="upc"
    jsbarcode-value="123456789012"
    jsbarcode-textmargin="0"
    jsbarcode-fontoptions="bold"&gt;
  &lt;/svg&gt;
  </code></pre>
  
  <p>I am getting an error when I try and run my node app. It is long and not really much use to me but hopefully one of you can understand it. Here it is:</p>
  
  <pre><code>/home/ubuntu/workspace/asset-management/node_modules/jsbarcode/bin/help/getRenderProperties.js:84
          var selector = document.querySelectorAll(string);
                                  ^
  
  ReferenceError: document is not defined
      at querySelectedRenderProperties (/home/ubuntu/workspace/asset-management/node_modules/jsbarcode/bin/help/getRenderProperties.js:84:26)
      at getRenderProperties (/home/ubuntu/workspace/asset-management/node_modules/jsbarcode/bin/help/getRenderProperties.js:37:10)
      at JsBarcode (/home/ubuntu/workspace/asset-management/node_modules/jsbarcode/bin/JsBarcode.js:63:60)
      at Object.&lt;anonymous&gt; (/home/ubuntu/workspace/asset-management/server/index.js:31:1)
      at Module._compile (module.js:570:32)
      at Object.Module._extensions..js (module.js:579:10)
      at Module.load (module.js:487:32)
      at tryModuleLoad (module.js:446:12)
      at Function.Module._load (module.js:438:3)
      at Module.require (module.js:497:17)
      at require (internal/module.js:20:19)
      at Object.&lt;anonymous&gt; (/home/ubuntu/workspace/asset-management/server.js:4:11)
      at Module._compile (module.js:570:32)
      at Object.Module._extensions..js (module.js:579:10)
      at Module.load (module.js:487:32)
      at tryModuleLoad (module.js:446:12)
      at Function.Module._load (module.js:438:3)
      at Module.runMain (module.js:604:10)
      at run (bootstrap_node.js:389:7)
      at startup (bootstrap_node.js:149:9)
      at bootstrap_node.js:504:3
  </code></pre>
  
  <p>If you have suggestions on a better package that can read and generate custom barcodes please let me know so I can look into it.</p>