Open a new page in a new window, print it and closed it stackoverflow <script type='text/javascript'> $(function(){ function openPrintWindow(url, name, specs) { var printWindow = window.open(url, name, specs); var printAndClose = function () { if (printWindow.document.readyState == 'complete') { clearInterval(sched); printWindow.print(); printWindow.close(); } } var sched = setInterval(printAndClose, 200); }; jQuery(document).ready(function ($) { $(".test").on("click", function (e) { var url = $(this).attr('data-url'); //Your url e.preventDefault(); openPrintWindow(url, "to_print", "width=700,height=400,_blank"); }); }); }); </script>