title: Javascript - Print Blob Content Returned from API
body: <p>I'm building a page for my <em>angular2</em> web application where a user can select customers from a list and print off letters to mail them. These letters were uploaded as <code>PDFs</code> and are stored as <code>varbinary</code> in the database.</p>
  
  <p>In the case of multiple selections, I'm simply appending byte[]'s so the user will print one document containing all of the letters to send to customers.</p>
  
  <p>I'm able to pull the blob successfully from the API and return it with the content type <code>application-pdf</code> but then I don't know what to do with it from there.</p>
  
  <p><strong>Here's my Angular2 Component API Call:</strong></p>
  
  <pre><code>this.printQueueService.getPrintContent(printRequests) //customers to receive letters
              .subscribe((data: Blob) =&gt; {
                  var element: HTMLIFrameElement = &lt;HTMLIFrameElement&gt;document.getElementById('printFile');
                  element.innerText = data + ""; //what do I do with the blob?
                  element.contentWindow.print();
  });
  </code></pre>
  
  <p><strong>HTML Element:</strong></p>
  
  <pre><code>&lt;iframe id="printFile" style="display:none"&gt;&lt;/iframe&gt;
  </code></pre>
  
  <p>I know I can just download the PDF and prompt the user to print using a PDF Viewer, but I'd rather not force users to go through extra steps.</p>
  
  <p>I'd also rather not try to render the PDF in the browser and print because it assumes users have the proper plugins and browsers support it.</p>
  
  <p><em>What options do I have for printing a blob in the browser?</em></p>