首页 > 技术文章 > 跨域调用报表展现页面的flash打印方法

shiGuangShiYi 2016-11-24 17:11 原文



环境说明:

  1. 项目的应用和润乾的报表应用分别部署在同一机器不同的web服务器上(IP相同,端口不同,项目的端口8080,报表应用的端口是6868)。

  2. 在项目中的父页面通过iframe调用报表展现页面。

  3. 在父页面中调用润乾中的flash打印的JS方法进行flash打印。

调用方式:

写了个简单的测试页面parent.html,将其放到非报表应用中进行测试,在非报表应用中的parent.html中通过document.getElementById("myFrame").contentWindow.report1_flashPrint();调用报表的flash打印功能。

 

parent.html的代码如下:

 

<html>
<head>
<script type="text/javascript">
function callChild(){
alert("flashPrint2");

document.getElementById("myFrame").contentWindow.report1_flashPrint();

}
</script>


</head>
<body>

<input id="button" type="button" value="调用报表应用中的flash打印函数" onclick="callChild()"/>
<iframe id="myFrame" name="myFrame" src="http://192.168.0.55:6868/demo/reportJsp/preview.jsp?rpx=%2Ftest.rpx&rpxHome=E%3A%2FProgram+Files%2Fraqsoft_1115%2Freport%2Fwebapps%2Fdemo%2FWEB-INF%2FreportFiles&dfxHome=E%3A%2FProgram+Files%2Fraqsoft_1115%2Freport"></iframe>
</body>
</html>

 

 

推荐阅读