title: Print Job delay when using IPP for Node JS
body: <p>I'm using <a href="https://npmjs.org/package/ipp">IPP</a> (and <a href="http://www.cups.org">CUPS</a>) with Node JS to print labels (DYMO Labelwriter 450 Turbo's) from our child check-in system. I need to print differing quantities (var <code>qty</code>) of each label depending on which room the child is in (1-3). Currently I'm creating a new IPP print job for each label - but there is a few seconds' delay between printings.</p>
  
  <p>Is there a way to pass quantities to IPP with each job to eliminate the delay? Or perhaps pass multiple of the same .pdf into a single job?</p>
  
  <p>Vars <code>pdf</code>(the generated label - using a <a href="http://cr8.me/u/label_b187.pdf">.pdf template</a>), <code>qty</code>(quantity of label that need to print) and <code>pid</code>(Printer ID of which printer to print to) are passed to the following bit of code:</p>
  
  <pre><code>function print(qty, pid, first, last, gender, room, notes, notesr, timestamp, age, grade, code) {
  
      fs.readFile('label.pdf', 'utf-8', function (err, pdf) {
  
          pdf = pdf.toString();
          pdf = pdf.replace('&lt;FIRST&gt;', first).replace('&lt;LAST&gt;', last).replace('&lt;GENDER&gt;', gender).replace('&lt;ROOM&gt;', room).replace('&lt;NOTES&gt;', notes).replace('&lt;NOTESON&gt;', notesr).replace('&lt;TIMESTAMP&gt;', timestamp).replace('&lt;AGE&gt;', age).replace('&lt;GRADE&gt;', grade).replace('&lt;CODE&gt;', code);
  
          if (err)
              throw err;
  
          var printer = ipp.Printer('http://127.0.0.1:631/printers/DYMO_'+pid);
          var file = {
              'operation-attributes-tag':{
                  'requesting-user-name': 'Test User',
                  'job-name': 'My Test Job',
                  'document-format': 'application/pdf'
              },
              data: new Buffer(pdf, 'binary')
          };
  
          for (var i = 0; i &lt; qty; i++) {
              printer.execute('Print-Job', file, function (err, res) {
                  console.log('Printed: '+res.statusCode)
              })
          }
      });
  }
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>It looks like my problem is that <a href="http://www.novell.com/support/kb/doc.php?id=7004646">CUPS waits for the printer to return to "idle"</a> before it begins processing the next job - thus creating the delay between jobs. An <a href="http://www.cups.org/documentation.php/doc-1.3/network.html#IPP">option</a>, <code>waitprinter=false</code> needs to be added to the DeviceURI to bypass the wait.</p>
  
  <p>I've tried adding it to the DeviceURI in <code>/etc/cups/printers.conf</code> with no avail. I've tried adding it to the <code>Printer</code> object url like:</p>
  
  <pre><code>var printer = ipp.Printer('http://127.0.0.1:631/printers/DYMO_'+pid+'?waitprinter=false');
  </code></pre>
  
  <p>Which errors that <em>printer cannot be found</em>. How do I use this option with IPP?</p>
  
  <p><strong>Update #2:</strong></p>
  
  <p>Out of urgency, I created a work-around using <a href="http://pdfkit.org">pdfkit</a> to generate multi-page label pdf's on the fly and sending all of the family's labels as a single print job.</p>