title: PDF.js 2.0.943 is not rendering PDF in browser
body: <p>I am trying to display PDF in browser, I found library <a href="https://github.com/mozilla/pdf.js" rel="nofollow noreferrer">PDF.js</a> which is most popular and most suggested library. Documentations and are clear, but one I try to use latest official release 2.0.943 document is not rendered, it gets loaded(as I see correct number of pages), but not visible.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
      &lt;!--&lt;script src="//mozilla.github.io/pdf.js/build/pdf.js"&gt;&lt;/script&gt;--&gt;
      &lt;script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.0.943/build/pdf.js"&gt;&lt;/script&gt;
  
      &lt;h1&gt;PDF.js Previous/Next example&lt;/h1&gt;
  
      &lt;div&gt;
          &lt;button id="prev"&gt;Previous&lt;/button&gt;
          &lt;button id="next"&gt;Next&lt;/button&gt;
          &amp;nbsp; &amp;nbsp;
          &lt;span&gt;Page: &lt;span id="page_num"&gt;&lt;/span&gt; / &lt;span id="page_count"&gt;&lt;/span&gt;&lt;/span&gt;
      &lt;/div&gt;
  
      &lt;canvas id="the-canvas"&gt;&lt;/canvas&gt;
      &lt;script&gt;
          $(document).ready(function () {
  
              var pdfData = atob(
                  'JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwog' +
                  'IC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAv' +
                  'TWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0K' +
                  'Pj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAg' +
                  'L1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+' +
                  'PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9u' +
                  'dAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2Jq' +
                  'Cgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJU' +
                  'CjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVu' +
                  'ZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4g' +
                  'CjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAw' +
                  'MDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9v' +
                  'dCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G');
  
              // Loaded via &lt;script&gt; tag, create shortcut to access PDF.js exports.
              var pdfjsLib = window['pdfjs-dist/build/pdf'];
  
              // The workerSrc property shall be specified.
              pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.0.943/build/pdf.worker.js';
              //pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js';
  
              // Using DocumentInitParameters object to load binary data.
              var loadingTask = pdfjsLib.getDocument({ data: pdfData });
              loadingTask.promise.then(function (pdf) {
                  console.log('PDF loaded');
  
                  // Fetch the first page
                  var pageNumber = 1;
                  pdf.getPage(pageNumber).then(function (page) {
                      console.log('Page loaded');
  
                      var scale = 1.5;
                      var viewport = page.getViewport({ scale: scale });
  
                      // Prepare canvas using PDF page dimensions
                      var canvas = document.getElementById('the-canvas');
                      var context = canvas.getContext('2d');
                      canvas.height = viewport.height;
                      canvas.width = viewport.width;
  
                      // Render PDF page into canvas context
                      var renderContext = {
                          canvasContext: context,
                          viewport: viewport
                      };
                      var renderTask = page.render(renderContext);
                      renderTask.promise.then(function () {
                          console.log('Page rendered');
                      });
                  });
              }, function (reason) {
                  // PDF loading error
                  console.error(reason);
              });
          });
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Official example fiddle: <a href="https://jsfiddle.net/pdfjs/wagvs9Lf/?utm_source=website&amp;utm_medium=embed&amp;utm_campaign=wagvs9Lf" rel="nofollow noreferrer">https://jsfiddle.net/pdfjs/wagvs9Lf/?utm_source=website&amp;utm_medium=embed&amp;utm_campaign=wagvs9Lf</a></p>
  
  <p>My fiddle with minor change(only version): <a href="https://jsfiddle.net/94x2ozbq/" rel="nofollow noreferrer">https://jsfiddle.net/94x2ozbq/</a></p>
  
  <p>From what I figured out: <code>var viewport = page.getViewport({ scale: scale })</code> returns object with height and width equal to <code>NaN</code></p>