How to know if PDF.JS has finished rendering?

后端 未结 12 1139
情深已故
情深已故 2020-12-13 14:44

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 even

12条回答
  •  情歌与酒
    2020-12-13 15:20

    At the time of writing, this did work. I'm not sure if it still does.

    PDFJS makes use of Promises. The easiest thing to do is the following:

    page.render(renderContext).promise.then(function(){
      document.body.appendChild(canvas);
    });
    

提交回复
热议问题