function pdfprint() {
printFormat = window.open("","_blank","");
printFormat.document.write("<html><head><title>Print </title>");
printFormat.document.write("<script> \n");
printFormat.document.write("function afterprint() { \n");
printFormat.document.write("self.close();\n");
printFormat.document.write("opener.<%=jspBean.FORM_PRINT_MEDIA%>.submit();\n");
printFormat.document.write("} \n");
printFormat.document.write("</");
printFormat.document.write("script");
printFormat.document.write(">");
printFormat.document.write("</head><body onunload='afterprint()'><embed src='" + URL + "' width='100%' height='100%'></embed>");
printFormat.document.write("<");
printFormat.document.write("script>window.navigator.disablewincheck = true;print()");
printFormat.document.write("</");
printFormat.document.write("script");
printFormat.document.write(">");
printFormat.document.write("</body></html>");
printFormat.document.close();
}
这里在上面的代码中,我给出了文件位于标签内的路径名,但它没有在浏览器上显示pdf文件(IE7),但在它运行良好之前