Is there any way to know the percentage of loading a PDF file in PDFJS?
I curently have the following code:
var filename = 'your_pdf_file.pdf';
PDFJS.getDocument(filename).then(function (pdf) {
console.info('File loaded:' + filename)
}).catch(function(pdf){
console.error('File not found:' + filename)
});
The problem is that I'm only able to know when the file was loaded.
Use progressCallback parameter in getDocument:
var progressCallback = function (progress) {
// progress object contains "total" and "loaded" properties
}
var filename = 'your_pdf_file.pdf';
PDFJS.getDocument(filename, null, null, progressCallback).then(function (pdf) {
console.info('File loaded:' + filename)
}).catch(function(pdf){
console.error('File not found:' + filename)
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.