Current File : /home/obabain/anms_obaba_in/PrintPurchasePdf.jsp |
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
footer {
font-size: 9px;
width:210mm;
text-align: left;
/* border-top:1px solid black; */
}
@page {
size: A4;
margin: 9mm 17mm 17mm 17mm;
}
@media print {
footer {
position: fixed;
bottom: 0;
/* border-top:1px solid black; */
width:210mm;
text-align:left;
}
body {
width: 210mm;
height: 297mm;
}
</style>
<script type="text/javascript">
function printPDF()
{
if (navigator.appName == 'Microsoft Internet Explorer') {
//Wait until PDF is ready to print
if (typeof document.getElementById("pdfDocument").print == 'undefined') {
setTimeout(function(){printPDF("pdfDocument");}, 1000);
} else {
var x = document.getElementById("pdfDocument");
x.print();
}
} else{
PDFIframeLoad(); // for chrome
}
}
//for Chrome
function PDFIframeLoad() {
var iframe = document.getElementById('iframe_a');
if(iframe.src) {
var frm = iframe.contentWindow;
frm.focus();// focus on contentWindow is needed on some ie versions
frm.print();
return false;
}
}
</script>
<script type="text/javascript">
function goBack() {
window.history.back();
};
</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
String from=request.getParameter("ddlsname");
//String to=request.getParameter("to");
%>
<div style="margin-left:760px;">
<input type="submit" value="Print"name="Submit" id="printbtn" onclick="printPDF()" />
<input type="button" value="Back" class="btn btn-info" onclick="goBack()"/><br>
</div><br>
<iframe id="iframe_a" name='iframe_a' src="Print.jsp" style="margin-left:60px;" width="900px" height="700px"></iframe> <!-- for Chrome -->
<embed type="application/pdf" src="pinvoicedesign.pdf" id="pdfDocument" width="0%" height="0%" >
</embed> <!-- for IE - u can display setted to 0% width and height-->
</body>
</html>