iframe content gets cut off when printing

前端 未结 5 968
谎友^
谎友^ 2021-01-05 11:56

I have a page with an iframe in it. The iframe\'s content is a couple of pages long, I\'ve set the iframe\'s height to match it\'s content. When I try to print the page, the

5条回答
  •  醉梦人生
    2021-01-05 12:40

    Just an idea: Do a focus on your ifame before print:

    var myf = document.getElementById("myiframe");
    var contentWindow = myf.contentWindow;
    contentWindow.focus();
    contentWindow.print();
    

提交回复
热议问题