Open Jude214 opened 6 years ago
see PDFJS issue https://github.com/mozilla/pdf.js/issues/9103
Muchas Gracias!, me abriste los ojos!
puedes hacer lo siguiente:
pdfSrc.value = pdf.createLoadingTask(pdfUrl.value, { onProgress: progress });
function progress(status) { const ratio = status.loaded / status.total; loadedRatio.value = Math.min(ratio, 1); if (loadedRatio.value === 1) { clearTimeout(timerId); timerId = setTimeout(() => { showProgressBar.value = false; loadedRatio.value=0; actionMsgProcess(false);
if (props.isPrintPDF) {
listenToPrint();
}
}, 1000);
} }
esa es mi implementacion, quizas te ayude.-
yo lo tengo funcionando, si necesitan ayuda puedo subir mi componente completo
In my project, the pdf component's progress event just return 'NaN' or '1' that I can't use the value for monitoring the pdf document loading progress. See the phenomenon below: In the pdf.vue source file, the parameter status in loadingTask.onProgress method has a total property whose value is 'undefined', so the ratio variable is undefined too and the 'onProgress' event method passes on an NaN with 'Math.min(ratio, 1)'. Here's the printscreen: And next time, the 'onProgress' method returns value '1', see the printscreen:
It seems that something was wrong when calculating the loading progress of the pdf document.