title: How to print Data-table with div content
body: <p>Unable to print datatable with border and div content.
  I already tried datatable print plugins but it can only print datatable..</p>
  
  <p><strong>HTML :</strong> </p>
  
  <pre><code>&lt;div class="col-md-12 col-xs-12 col-sm-12 panel panel-default" id="testreportTable"&gt;
          &lt;button class="btn btn-default" id="btnPrint"&gt;Print&lt;/button&gt;
          &lt;div class="col-md-12 col-xs-12 col-sm-12 text-center" &gt;
              &lt;h4&gt;Stack OverFlow Test&lt;/h4&gt;
          &lt;/div&gt;
          &lt;div class="col-md-12 col-xs-12 col-sm-12"&gt;
              &lt;h5&gt;&lt;b&gt;Test Page&lt;/b&gt;&lt;/h5&gt;
          &lt;/div&gt;
          &lt;div class="col-md-12 col-xs-12 col-sm-12 table-responsive"&gt;
              &lt;table class="table table-striped table-bordered table-responsive" id="TestReportTable"&gt;
                   &lt;thead&gt;
                        &lt;tr&gt;
                           &lt;th&gt;Name&lt;/th&gt;
                           &lt;th&gt;Location&lt;/th&gt;
                           &lt;th&gt;Duration&lt;/th&gt;
                           &lt;th&gt;Remarks&lt;/th&gt;
                        &lt;/tr&gt;
                  &lt;/thead&gt;
            &lt;/table&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p><strong>JavaScript :</strong> </p>
  
  <pre><code>var data = [
  {name:"Fiat", location:"Mumbai", duration:"2 Hours",remarks:"Ready"},         {name:"Tata", location:"Mumbai", duration:"3 Hours",remarks:"Ready"}
                  ];
  
   var ops_table = $('#TestReportTable').dataTable(
               {
                   "bPaginate": false,
                   "bLengthChange": false,
                   "bFilter":true,
                   "bInfo" : false,
                   "oLanguage": {
                         "sSearch": ""
                     },
                   "aoColumns":[{"bSearchable": true},{"bSearchable":true},{"bSearchable":true},{"bSearchable":true}]
               });
  
       var dataArray = [];
       $.each(data,function(i,dataFirst)
  {dataArray.push([dataFirst.name,dataFirst.location,dataFirst.duration,dataFirst.remarks]);
       })
  
        ops_table.fnClearTable();
          ops_table.fnAddData(dataArray);
  
      function getPrint(){
          var divToPrint=$('#testreportTable');
          var newWin=window.open('','Print-Window');
          newWin.document.open();
          newWin.$(document.body).append('&lt;html&gt;&lt;body onload="window.print()"&gt;'+divToPrint.innerHTML+'&lt;/body&gt;&lt;/html&gt;');
          newWin.document.close();
          setTimeout(function(){newWin.close();},10);
      }
  
  
      $('#btnPrint').on('click',function(){
          getPrint()
      })
  </code></pre>
  
  <p>please refer this fiddle..</p>
  
  <p><a href="https://jsfiddle.net/raskarvishal7/Lk6n8pyw/1/" rel="nofollow">Fiddle</a></p>
  
  <p>please suggest..</p>
  
  <p>Thnks..</p>