[英]Jquery print preview not showing full page
I'm using this tool to make a print preview of my page. 我正在使用此工具对页面进行打印预览。
I have a table in my page. 我的页面上有一张桌子。 So when I draw preview after pageload, it' not showing full page in Firefox .
因此,当我在页面加载后绘制预览时, 它不会在Firefox中显示整页 。
But in chrome same page is working perfectly, showing a full preview. 但是在chrome中,同一页面运行良好,显示了完整的预览。
Codes. 代码。
<link rel="stylesheet" href="{{ asset('bundles/joy/css/print.css') }}" type="text/css" />
<link rel="stylesheet" href="{{ asset('bundles/joy/print/css/print-preview.css') }}" type="text/css" />
<link rel="stylesheet" href="{{ asset('bundles/joy/css/print.css') }}" type="text/css" media="print"/>
This print.css is made by me.It's not from the plugin example. 这个print.css是我做的,不是来自插件示例。
$('body').printPreview();
$.printPreview.loadPrintPreview();
Am I missing something? 我想念什么吗? How can I see the full preview in both firefox and chrome??
如何在Firefox和chrome中看到完整的预览?
Problem was in iFrame height . 问题出在iFrame高度上 。 If I adjust the iFrame height based on my total Page Height, it works correctly.
如果我根据总页面高度调整iFrame高度,则它可以正常工作。
The Demo example also contain the problem in Firefox as of 10-02-14(Downloaded demo code). 演示示例还包含截至10-02-14(已下载演示代码)的Firefox中的问题。 The footer or the copyright notice cuts into half in the print preview example.
在打印预览示例中,页脚或版权声明减少了一半。
So here is what I did. 这就是我所做的。 In the
jquery.print-preview,js
file, I replaced all instances of 在
jquery.print-preview,js
文件中,我替换了
print_frame.height($('body', print_frame.contents())[0].scrollHeight);
with 与
heights=Math.max($(document).height(), $(window).height())+30;
print_frame.height(parseInt(heights));
This will set the iframe height with actual document height. 这会将iframe高度设置为实际文档高度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.