您嘗試直接下載使用一個元素屬性下載
<a href="/images/myw3schoolsimage.jpg" download>
---- ---- OR
<button id="print" onclick="print('uname');" >Print</button>
<div id="uname">
<label>Name</label>
<label>Spider</label>
</div>
<button id="print" onclick="printContent('uname');" >Print</button>
function print(e){var divToPrint=document.getElementById('e');
var newWin=window.open('','Print-Window');
newWin.document.open();
newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>');
newWin.document.close();
setTimeout(function(){
newWin.close();
},10);
}
Demo Here
檢查HTTPS: //stackoverflow.com/questions/2255291/print-the-contents-of-a-div –
你可以有服務器創建並交付它_而不保存在那裏。所以即時生成。 – arkascha
@AhmedGinani我會檢查它,謝謝你 – rinaldy31