How to know if PDF.JS has finished rendering?

后端 未结 12 1153
情深已故
情深已故 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:19

    I have changed my code in this way and it helped me what I wanted to do:

    pageRendering = page.render(renderContext);
    pageRendering.onData(function(){
        var myImage = new Image();
        myImage.src = document.getElementById('my-canvas-id').toDataURL();
        $('body').append(myImage);
    });
    

    This helps only if the specific page has finished rendering. it doesn't tell you about the rendering of all of the pages.

提交回复
热议问题