我想在打印页面中以横向模式打印数据

时间:2019-08-20 12:52:32

标签: javascript jquery datatable

当前我的表格数据以A4尺寸打印,但我想以横向模式打印

我的代码:

<button id="print" name="print"  onclick="printContent('print_loading_sheet')" class="btn btn-block btn-outline-primary fa fa-newspaper-o col-10 offset-1" style="margin-top: 35px; margin-bottom: 25px;" data-clicked="unclicked"> Print Loading Sheet Report</button>


<script>
     function printContent(e1){
     event.preventDefault();
          var allVals = [];
        $('input[name=selectedrecord]:not(:checked').each(function() {
           allVals.push($(this).val());
           });

             allVals.forEach(function(i){
            $('tr').each(function(){
            $(this).find('td, th').eq(i-1).css({
                       display:'none'
           });
        });
      });

      $('input[name=selectedrecord]').css('visibility', 'hidden'); //hiding Check box on print page
      var restorepage     = document.innterHTML;
      var printContent    = document.getElementById(e1).innterHTML;
      document.innterHTML = printContent;
      window.print();
      document.location.href = "<?php echo base_url(); ?>"; 
   }
</script>

我可以在其中更改景观代码的地方。

0 个答案:

没有答案