I am using jquery Print Plugin
$(document).ready(function() {
$(".printButton").printPage({
url: "pages/report.html",
attr: "href",
message:"Your document is being generated"
});
});
Jsp Page with the above script
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<script>
$(document).ready(function() {
$(".printButton").printPage({
url: "pages/report.html",
attr: "href",
message:"Your document is being generated"
});
});
</script>
</head>
<body>
<h1>Press Yes to Print </h1>
<p><a class="printButton" href='exception.jsp'>Yes</a></p>
</body>
</html>
When first time open the page, and press yes , it print in one time and when I open the page second time , on pressing yes, it print 2 pages on a single click, and third time it print three pages on a single click.
Its means on every click ,jquery print plugin library load again and again. How can we control this?