You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since #6551 landed, we have black flickering before the content finally shows up. We use the api to render pdfs in our own DOM-Containers. What do we need to change to get rid of the flickering?
I tested in Chrome 46. I think it is the same issue why #4556 got reverted.
Here is a snip of our code:
PDFJS.getDocument(url,null,null,function(status){varprogressBar=Y.one('.pdf-js-container .progress-bar');if(!progressBar){return;}if(!status||!status.loaded||!status.total){progressBar.one('.percent').setContent('Error loading document. Please try again later.');return;}varprogress=parseInt((status.loaded/status.total)*100,10)+'%';progressBar.one('.percent').setContent(progress);progressBar.one('.bar').setStyle('width',progress);}).then(function(pdfDocument){that.pdfDocument=pdfDocument;for(letpageNum=0;pageNum<pdfDocument.numPages;pageNum++){that._createPagePlaceHolder(pageNum+1);// way faster}for(letpageNum=0;pageNum<pdfDocument.numPages;pageNum++){that._appendPage(pageNum+1);}});
...
_appendPage: function(pageNumber){varthat=this;varrenderPageInterval;that.pages[pageNumber]=null;// Poor person's promises:// Very complex PDFs can mess with PDF.JS internal housekeeping and thus produce empty pages// Thus we make sure that page render promises are only given once all previous pages have been renderedvarrenderPageIntervalCall=function(){renderPageInterval=setInterval(renderPageWhenReady,250);};// Associates the actual page with the view, and drawing itvarrenderPageWhenReady=function(){// The first page obviously does not have a predecessor that might get filled with content// Querying for #pageContainer(n-1) .canvasWrapper is not ideal, but still better then setting up more event listenersif(pageNumber===1||document.querySelector('#pageContainer'+(pageNumber-1)+' .canvasWrapper')!==null){that.pdfDocument.getPage(pageNumber).then(function(pdfPage){varpageContainer=Y.one('#pdf-reader-page-'+pageNumber);varpdfPageWidth=pdfPage.getViewport(1.0).width;varscale=that._calculateScale(pdfPageWidth);varpdfPageView=newPDFPageView({container: pageContainer,id: pageNumber,// PDF.js internal converts the scale to css units (96.0/72.0 = 1.333), so we need to revert this herescale: scale*0.75,defaultViewport: pdfPage.getViewport(scale),textLayerFactory: newDefaultTextLayerFactory(),annotationsLayerFactory: newDefaultAnnotationsLayerFactory()});pdfPageView.setPdfPage(pdfPage);pdfPageView.draw().then(function(){
...
});});clearInterval(renderPageInterval);}};renderPageIntervalCall();},
The text was updated successfully, but these errors were encountered:
You need to show canvas only when rendering is done or at the first onContinue callback call. The PDFPageView shall take care of that though. I cannot run the code snipped provided above, please publish a complete example online.
Since #6551 landed, we have black flickering before the content finally shows up. We use the api to render pdfs in our own DOM-Containers. What do we need to change to get rid of the flickering?
I tested in Chrome 46. I think it is the same issue why #4556 got reverted.
Here is a snip of our code:
The text was updated successfully, but these errors were encountered: