Promise problem rendering page
See original GitHub issueHello.
I am using PDF.js in an angular service to make a custom viewer, the problem is the render page promise, the render task is working and rendering the PDF page in the canvas but i need a callback and for some reasons the promise is not working.
PDF version: 1.0.68
var renderContext = {
canvasContext: context,
viewport: viewport,
};
var renderTask = page.render(renderContext);
renderTask.then(function(){
console.log("SUCCESS");
}, function(error){
console.error("ERROR");
});
I also have tried:
renderTask.promise.then(function(){
console.log("SUCCESS");
}, function(error){
console.error("ERROR");
});
And
var renderTask = page.render(renderContext).then(function(){
alert("PROMISE");
});
The page renders well but the problem is the promise, debugging in the chrome console i found that renderTask.promise:
Promise {resolve: function, reject: function, then: function, catch: function}
I just do not understand, how is supposed to be used the promise in page.render().
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Why does the Promise object block rendering? - Stack Overflow
Promises are a way to manage asynchronous code, not a way to make code asynchronous, nor a way to simulate multithreading.
Read more >Examples
The example demonstrates how promises can be used to handle errors during loading. It also demonstrates how to wait until a page is...
Read more >OfflineAudioContext.startRendering() - Web APIs | MDN
startRendering . When the startRendering() promise resolves, rendering has completed and the output AudioBuffer is returned out of the promise.
Read more >Suspense on React: The Act of Rendering While You Load
The above codebase has a loading state or a default UI rendered by the app while it waits for the promise to be...
Read more >UI5 Rendering Issues using promises - SAP Community
From a quick review, I think you need to use a model to capture the response from the promise, instead of just variables....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
1.0.68 is older than 1.0.233, sounds like you upgraded
We are not experts in bower. There were few bower users who are interested in helping, but no actions were taken so far – just talking.
Well i have downgrade to v1.0.233 and the promise are working again, i do not know if bower cause the problem updating the source, but i think that PDF.js needs an official bower package including a build and the source code.
Thanks for your time, problem solved!