2017-08-30 102 views
-1

我的代碼通過jsPDF生成的PDF是這個 -電子郵件的角度2+

let output = pdf.output(); 
let base64data= btoa(output); 
return window.open("mailto:[email protected]? 
subject=Test&body=Test&attachments='" +base64data+ "'"); 

或者還有一種方法來發送電子郵件,但window.plugins在下面的代碼棄用。 有沒有其他的選擇,這也是有幫助的?

var pdf = new jsPDF(); 
pdf.text(0, 0, 'Hello World!'); 
var pdfBase64 = pdf.output('datauristring'); 
window.plugins.email.open({ 
    to: ['[email protected]'], 
    subject: 'New PDF!', 
    body: 'Hi there, here is that new PDF you wanted!', 
    isHTML: false, 
    attachments: [pd] 
}); 

回答

0

正如你寫的初始化windows.open在Chrome60已經過時了。相反,您可以使用嵌套在window中的iFrame

例如:

var window = window.open("", "", "width=640,height=480"); 

window.document.write('<iframe src="' + any_content+ '" frameborder="0" style="border:0; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%;" allowfullscreen></iframe>'); 

它是從任何其他計算器主題溶液。

+0

對不起,實際上window.plugins已棄用,我需要它的替代品 –