Current File : /home/obabain/khb_obaba_in/sopdf.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') {

    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();  
            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> </title>
</head>
<body>
  

<table>
<tr>
<td>
<%String id=request.getParameter("Id"); %>
<iframe id="iframe_a" name='iframe_a' src="SalesOrderpdfDesign.jsp?Id=<%=id %>"   width="800px"   height="800px"></iframe>        <!-- for Chrome -->

<embed    type="application/pdf"    src="SalesOrderpdfDesign.pdf"    id="pdfDocument"    width="0%"    height="0%" >
</embed> <!-- for IE - u can display  setted to  0% width and height-->

<input type="submit"  value="Print"name="Submit" id="printbtn" onclick="printPDF()" />
<input type="button" value="Back"  class="btn btn-info"  onclick="goBack()"/>
</td></tr><tr>
<td>
</td>
</tr></table>
</body>
</html>