title: PDF.js get AcroForm element positions/dimensions
body: <p>I'm trying to parse a PDF document, and that comes along nicely. The PDF is created in Adobe FormCentral, and contains a single form element (date field).</p>
  
  <p>head:</p>
  
  <pre><code>&lt;script type="text/javascript" charset="utf-8" src="jquery.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" charset="utf-8" src="common.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" charset="utf-8" src="pdfjs/build/pdf.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" charset="utf-8" src="mscripts.js"&gt;&lt;/script&gt;
     &lt;script type="text/javascript"&gt;
      $(document).ready(function() {
          loadPDFJS();
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>body:</p>
  
  <pre><code>&lt;div id="viewer"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>js:</p>
  
  <pre><code>function loadPDFJS(){
      var canvasContainer = document.getElementById('viewer');
      PDFJS.workerSrc = 'build/pdf.worker.js';
  
      PDFJS.getDocument('mpdf.pdf').then(function(pdf) {
          pdf.getPage(1).then(renderPage);
  
          function renderPage(page) {
              console.log(page);
              var xyz = window.getComputedStyle(canvasContainer);
              var w = parseInt(xyz.width.replace("px", ""));
  
              var viewport = page.getViewport(1);
              var scale = w / viewport.width;
              var scaledViewport = page.getViewport(scale);
  
              var canvas = document.createElement('canvas');
              var context = canvas.getContext('2d');
              canvas.height = scaledViewport.height;
              canvas.width = scaledViewport.width;
  
              var renderContext = {
                  canvasContext: context,
                  viewport: scaledViewport
              };
              page.render(renderContext).then(function () {
                  document.getElementById('viewer').appendChild(canvas);
              });
          }
      });
  }
  </code></pre>
  
  <p>And this code indeed renders the PDF. But here comes the problem. I need to know the dimensions and positions of the elements (in this case, only one). I've looked into the Demo on the PDF.js github page, and logged the page object. In PDF documents which contains text, I noticed the logged PDFPage contains the texts (however I can't extract any dimensions), but form elements do not seem to be parsed whatsoever. Maybe they are part of the background?</p>
  
  <p>All I can find is a Java library for accessing those AcroForm fields, <a href="https://stackoverflow.com/questions/28109932/get-font-and-size-of-an-acroform-field">here</a>, but I'd rather just stick to one library (preferably PDF.js)</p>
  
  <p>Question: How can I retrieve the positions and dimensions of all form elements of a PDF document using PDF.js?</p>