title: How to know if PDF.JS has finished rendering?
body: <p>I am using PDF.JS to render pdf pages into different canvas elements. my requirement is to capture the output of the canvas and to display it as an image. Is there some event to know if the rendering of the pdf page in canvas has been finished or not. because when I try to capture the output of canvas it is blank. but the pdf page is rendered properly. <strong>it looks like my capture event is being called before the pdf.js finishes the rendering process.</strong></p>
  
  <p>here is my code:</p>
  
  <pre><code>page.render(renderContext);
  var myImage = new Image();
  myImage.src = document.getElementById('my-canvas-id').toDataURL();
  $('body').append(myImage);
  </code></pre>
  
  <p>If I execute the same code in my FireFox's console this works fine. so nothing is wrong with this code. </p>
  
  <p>Just to let you people know that I already have tried document.ready and window.load events.</p>