Current File : /home/obabain/public_html/abc/GRN.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>
<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("from");
String to=request.getParameter("to");
String prodname=request.getParameter("product_id");

%>
<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="GRNPdf.jsp?from=<%=from %>&to=<%=to %>&product_id=<%=prodname %>" style="margin-left:60px;"  width="850px"   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>