โค้ดสำหรับแสดงองค์ประกอบ HTML5 Canvas:
<a href="javascript:print_voucher()">PRINT CANVAS</a>
function print_canvas() {
$("#canvas_voucher").printElement();
}ที่นี่ canvas_voucher คือ ID ของ canvas element เพื่อทำงาน ต้องแปลง canvas เป็น .png image URL และเปิดในหน้าต่างเบราว์เซอร์ใหม่ พร้อมแสดง print dialog
function print_canvasr(){
var win1 = window.open();
win1.document.write("<br><img src = '" + canvas.toDataURL() + "'/>");
win1.print();
win1.location.reload();
}