<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test print in browser</title>
</head>
<body>
<p>This method will be print with print dialog.</p>
<p>To make it auto print or print silently,<br>
style iframe to be invisible,<br>
follow this link
<a href="http://www.bauer-power.net/2007/12/print-without-prompt-in-firefox.html#.VANyZmMSuUk" target="_blank">http://www.bauer-power.net/2007/12/print-without-prompt-in-firefox.html#.VANyZmMSuUk</a>
</p>
<p>Print PDF in IE will be open the PDF outside!<br>
Print PDF in other browsers cannot set margin.<br>
Print PDF in Firefox will be error "Permission denied to access property 'print'"</p>
</p>
<iframe id="pdf-print-iframe" name="pdf-print-iframe-name" src="" style="height: 300px; width: 900px;"></iframe>
<script>
function printPDF(pdfUrl)
{
var w = window.open(pdfUrl, 'pdf-print-iframe-name');
setTimeout(function() {w.print();}, 900);
}
</script>
<button type="button" onclick="printPDF('bill-sample.pdf');">Print PDF</button>
<button type="button" onclick="printPDF('test-print-use-browser.html');">Print HTML</button>
</body>
</html>