简体   繁体   中英

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(); and still having the same problem, here is my js:

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

Also I tried this in my css:

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

please help ! EDIT: I forgot to mention that I use bootstrap 3 framework

Use the .ajax jQuery provides to see what your DOM is doing actually using what I have here.

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

Creating from the script your html also gives information..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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