eKoopmans / html2pdf.js

Client-side HTML-to-PDF rendering using pure JS.
MIT License
4.13k stars 1.39k forks source link

on production pdf not download #568

Open billmorgan123 opened 2 years ago

billmorgan123 commented 2 years ago

live application are loaded in iframe in which i use this module and in catch block this "Unable to find element in cloned iframe" error occurred html2pdf?.() ?.set?.({ margin: 0, filename: 'invoice', image: { type: 'jpeg', quality: 0.98, }, enableLinks: true, html2canvas: { scale: 2, }, jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait', }, pagebreak: { mode: ['avoid-all', 'css', 'legacy'], }, }) ?.from?.(element) // ?.toPdf?.() ?.save?.() .then(()=>{ vm.$modal.hide(vm.modalName) }) .catch((ex)=>{ console.log('ex',ex) const html_to_pdf_overlay_els = document.getElementsByClassName('html2pdf__overlay') ?? [] for (let index = 0; index < html_to_pdf_overlay_els.length; index++) { const element = html_to_pdf_overlay_els[index]; if(element) element.parentNode.removeChild(element); } }) .finally(()=>{ complete() }) ?? complete();

nongtiny commented 1 year ago

I face this error also. Do you know how to solve it? @billmorgan123