简体   繁体   English

javascript只打印一半页面

[英]javascript prints only half of the page

I'm trying to print an element (body) using jquery plugin https://github.com/jasonday/printThis , but it only prints half of the element(vertically) , So I need to print the entire element , it's not only with the plugin, I tried raw javascript : window.print(); 我正在尝试使用jquery插件https://github.com/jasonday/printThis打印一个元素(正文),但它只打印了一半元素(垂直),所以我需要打印整个元素,它不仅仅是使用插件,我尝试了原始的javascript: window.print(); and still having the same problem, here is my js: 并且仍然有同样的问题,这是我的js:

print: function (jqueryElement) {
      //jqueryElement.printThis();
      window.print();
},

Also I tried this in my css: 我也在我的CSS中试过这个:

@media print {
      body {
          width: 100%;
      }
}

please help ! 请帮忙 ! EDIT: I forgot to mention that I use bootstrap 3 framework 编辑:我忘了提到我使用bootstrap 3框架

Use the .ajax jQuery provides to see what your DOM is doing actually using what I have here. 使用.ajax jQuery提供实际使用我在这里的东西来查看你的DOM正在做什么。

$.ajax({
    print: function(errorProneWindowElement) {
    window.print();
 }
success: function( result ) {
    $( "#elementTagDescriptor" ).html( "<elementFrameCalled>" + result + "          </elementFrameCalled>" );
  }
 });

Creating from the script your html also gives information.. 从脚本创建你的html也提供信息..

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM