I. Description
The user system uses an iframe to embed the report. The client browser sees the report style 1. When printing, it is not the result, but style 2.
For example, the size of the iframe of the report displayed by the user system is fixed, and the A4 paper size template cannot be displayed completely. Therefore, the report is displayed in a paging process, such as displaying 10 pieces of data per page. If you print this display result directly on A4 paper, only 10 pieces of data are displayed on each page, and the following are all blank, which is not beautiful and wastes paper, so I hope to print as normal pages when printing.
II. Solution
Similar to the above-mentioned situation where the printing effect is different from the report viewing effect, the unified solution is to make two templates, one corresponding to the viewed template; the other corresponding to the printed template;
When printing, call FR's printing method through JS to print out the printing template.
III. Implementation step
When you click to print, call FR's printing method through JS, and use the print template to print, as follows:
<html>
<head>
<script type="text/javascript" src="/webroot/decision/view/report?op=emb&resource=finereport.js"></script>
<link rel="stylesheet" type="text/css" href="/webroot/decision/view/report?op=emb&resource=finereport.css"/>
<script type="text/javascript">
function doFRPrint(){ //Trigger when you click to print
var reportURL="/webroot/decision/view/report?reportlet=report_print.cpt"; //Print the template path, which is different from the effect viewed by BS
FR.doURLFlashPrint(reportURL); //Call the FR printing method
}
</script>
</head>
<body>
<div id="toolbar">
<button type="button" onclick=doFRPrint()>Print</button>
</div>
<iframe id="reportFrame" src="/webroot/decision/view/report?reportlet=report.cpt&__showtoolbar__=false" width=100% height=80%></iframe>
</body>
</html>
IV. Mobile
The mobile terminal does not support various printing and exporting methods.