[英]JsPDF .save() doesn't work
這段代碼可讓我下載pdf,但在將其放入iframe時出現錯誤:
docNormale.save('Ordini.pdf');
var iframe = document.getElementById('outputPDFnormale');
iframe.style.width = '60%';
iframe.style.height = '650px';
iframe.src = docNormale.output('datauristring');
這段代碼可讓我將pdf插入iframe中,但在下載pdf時出現錯誤:
var iframe = document.getElementById('outputPDFnormale');
iframe.style.width = '60%';
iframe.style.height = '650px';
iframe.src = docNormale.output('datauristring');
docNormale.save('Ordini.pdf');
錯誤在兩種情況下都是相同的,並且是:未捕獲的TypeError:無法讀取未定義的屬性“ toFixed”
我在最新版的Chrome中
這是對lib的錯誤/限制,save()是輸出操作,並且不支持兩個這樣的連續操作atm,因此請隨時在其問題跟蹤器上提交錯誤: https : //github.com/MrRio/ jsPDF /問題
同時,這應該起作用:
var rawdata = docNormale.output();
var len = rawdata.length,
ab = new ArrayBuffer(len),
u8 = new Uint8Array(ab);
while(len--) u8[len] = rawdata.charCodeAt(len);
var blob = new Blob([ab], { type : "application/pdf" });
saveAs(blob, 'Ordini.pdf');
var iframe = document.getElementById('outputPDFnormale');
iframe.style.width = '60%';
iframe.style.height = '650px';
iframe.src = URL.createObjectURL(blob);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.