Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角打印打印第二个空白页_Javascript_Jquery_Angularjs - Fatal编程技术网

Javascript 角打印打印第二个空白页

Javascript 角打印打印第二个空白页,javascript,jquery,angularjs,Javascript,Jquery,Angularjs,我正在尝试打印html页面的内容 我正在使用它,但我的问题是,在页面预览中,我正在进入页面。第一个有内容,第二个是空白页。我正试图摆脱空白页。 这是我的html <div id="invoice" print-section="" print-only=""> <div class="invoice"> <div class="invoice-company">{{user.store.name}}</div> <

我正在尝试打印html页面的内容

我正在使用它,但我的问题是,在页面预览中,我正在进入页面。第一个有内容,第二个是空白页。我正试图摆脱空白页。

这是我的html

    <div id="invoice" print-section="" print-only="">
  <div class="invoice">
    <div class="invoice-company">{{user.store.name}}</div>
    <div class="invoice-header">
      <div class="invoice-from"><small>from</small>
        <address class="m-t-5 m-b-5"><strong>{{user.store.name}}.</strong><br/>{{user.store.address.street}}<br/>{{user.store.address.city}}, {{user.store.address.zipCode}}<br/>Phone: {{user.store.phone}}</address>
      </div>
      <div class="invoice-date">
        <div class="date m-t-5">{{saleDate | date:'MM/dd/yyyy'}}</div>
        <div class="invoice-detail"># {{saleId}}<br/>Cashier {{user.firstName}}</div>
      </div>
    </div>
    <div class="invoice-content">
      <div class="table-responsive">
        <table class="table table-invoice">
          <thead>
            <tr>
              <th>Item</th>
              <th>Price</th>
            </tr>
          </thead>
          <tbody>
            <tr ng-repeat="item in sale.items">
              <td>{{item.name}} {{item.size}}</td>
              <td>{{item.price | currency}}</td>
            </tr>
            <tr ng-repeat="discount in sale.discounts">
              <td>{{discount.name}}</td>
              <td>- {{discount.price | currency}}</td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="invoice-price">
        <div class="invoice-price-left">
          <div class="invoice-price-row">
            <div class="sub-price"><small>SUBTOTAL</small>{{sale.subtotal | currency}}</div>
            <div class="sub-price"><i class="fa fa-plus"></i></div>
            <div class="sub-price"><small>TAX</small>{{sale.tax}}</div>
          </div>
        </div>
        <div class="invoice-price-right"><small>TOTAL</small>{{sale.total | currency}}</div>
      </div>
    </div>
    <div class="invoice-footer text-muted">
      <p class="text-center m-b-5">Thank you for coming.<br/>We hope you'll visit again.</p>
    </div>
  </div>
</div>

{{user.store.name}
从…起
{{user.store.name}.
{{user.store.address.street}
{{user.store.address.city},{{user.store.address.zipCode}
电话:{user.store.Phone} {{saleDate}日期:'MM/dd/yyyy'} #{{saleId}
出纳{{user.firstName} 项目 价格 {{item.name}{{item.size} {{item.price | currency}} {{discount.name} -{{折扣.价格|货币} 小计{销售.小计|货币} 税收{{销售.税收} 总计{sale.TOTAL | currency}

感谢您的光临。
希望您再次光临

这是触发打印操作的指令

<button type="button" print-btn="">Print</button>
打印
我想要一个解决方案,不管我是必须使用纯javascript/jQuery还是根本不使用任何指令。我只是希望能够填充发票并打印它

提前谢谢。

您可以添加

#invoice:last-child {
    page-break-after: auto;
}
删除最后一页


注意:IE中不支持此
@media print{body#invoice{width:90%;max width:1048px;}
我尝试过:@media print{invoice:last child{page break after:always!important;}