Javascript 如何将完整文档发送到打印机

Javascript 如何将完整文档发送到打印机,javascript,php,html,printing,thermal-printer,Javascript,Php,Html,Printing,Thermal Printer,我使用的是laravel刀片,我以html标记格式将数据传递给打印机。我在一页中打开多张发票,并将所有标记发送给打印机,以便立即打印,但问题是它打开所有发票,但只发送第一张发票,不打印剩余发票。这是我的代码,其中im发送id=“prnt”到最后一个document.getElementById('prnt').innerHTML中 这里是完整的代码 <!DOCTYPE html> <html lang="{{ app()->getLocale() }}&

我使用的是laravel刀片,我以html标记格式将数据传递给打印机。我在一页中打开多张发票,并将所有标记发送给打印机,以便立即打印,但问题是它打开所有发票,但只发送第一张发票,不打印剩余发票。这是我的代码,其中im发送id=“prnt”到最后一个
document.getElementById('prnt').innerHTML中
这里是完整的代码

    <!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>Order Details</title>
      <!-- Bootstrap core CSS-->
    <link href="{{ asset('assets/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
      <!-- Custom fonts for this template-->
    <link href="{{ asset('assets/font-awesome/css/font-awesome.min.css') }}" rel="stylesheet" type="text/css">

    <!-- Latest compiled and minified JavaScript -->
    <style>
        .border-top{ border-top: 1px solid #eee; } .padding-20px{padding: 20px}
        @media print {
            .hidden-print { display:none !important; }
        }
        
    </style>
</head>
<body>
    
        @foreach($data as $inv_row)
        <section class="invoices-section">
            <div class="container">
                <div class="row">
                    <div class="col-md-3"></div>
                    <div class="col-md-6">
                    <!--<p class="text-center" align="1">{{ date('d/m/Y h:i:sa') }}</p>-->
                    <div id="prnt">
                        <img class="img-fluid" src="{{ asset('images/order DESIGN.bmp') }}" alt="Invoice Header Image" width="470px" height="200px"/>
                        <table class="table table-bordered table-custom-th" width="100%" cellspacing="0">
                            <p>Customer Name: {{ strtoupper($inv_row->customer->user->name) }}</p>
                            <!--@foreach($inv_row['ordertakers'] as $otd)-->
                            <!--<p>Customer Name: {{ strtoupper($otd->ordertaker->name) }}</p>-->
                            <!--@endforeach-->
                            <p>Address: {{ $inv_row->customer->address }}</p>
                            <p>Phone   : {{ $inv_row->customer->phone }}</p>
                            <p>Date: {{ date('d/m/Y h:i:sa' , strtotime($inv_row->created_at)) }} / Bill No: {{ $inv_row['bill_no'] }}</p>
                            <p class="text-center">*******************************</p>
                            @foreach($inv_row['order_details'] as $inv_detail)
                            <tr>
                                <td>
                                    <p class="text-center" align="1">         --------------</p>
                                </td>
                            </tr>
                            <tr>
                                <td class="text-center" align="1"><?php echo $inv_detail->product->name; ?></td>
                            </tr>
                            <tr>
                                <td>
                                    <p class="text-center" align="1">         --------------</p>
                                </td>
                            </tr>
                            <tr>
                                <td>Price :{{ $inv_detail->amount / $inv_detail->unit }}</td>
                            </tr>
                            <tr>
                                <td>Unit  :{{ $inv_detail->unit }}</td>
                            </tr>
                            <tr>
                                <td>Amount:{{ $inv_detail->amount }} </td>
                            </tr>
                            <?php $is_c_benefit = App\CustomPrice::where(['customer_id' => $inv_detail->order->customer_id, 'product_id' => $d->product_id])->first();?>
                            @endforeach
                        </table>
                        <p class="text-center">*******************************</p>
                        <table class="table">
                            <tbody>
                                <tr>
                                    <td>
                                        Sub Total: {{$inv_row->subtotal }}
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Discount: {{ $inv_row->discount }}
                                    </td>
                                </tr>
                                @if($inv_row['prev_invoices_details']->amount_left>0)
                                <tr>
                                    <td>
                                        Balance  : {{ $inv_row['prev_invoices_details']->amount_left }}
                                    </td>
                                </tr>
                                @elseif($inv_row['prev_invoices_details']->amount_left<0)
                                <tr>
                                    <td>
                                        Prev Advance : {{ $inv_row['prev_invoices_details']->amount_left*-1 }}
                                    </td>
                                </tr>
                                @endif
                                @if($inv_row->amount>0)
                                <tr>
                                    <td>
                                        Total    :{{ $inv_row->amount + $inv_row['prev_invoices_details']->amount_left - $inv_row->discount }}
                                    </td>
                                </tr>
                                @if($inv_row->received_amount>0 && $inv_row->amount_left>=0)
                                <tr>
                                    <td>
                                        Received: {{ $inv_row->received_amount }}
                                    </td>
                                </tr>
                                @if($inv_row->discount != 0)
                                <tr>
                                    <td>
                                        Discount: {{ $inv_row->discount }}
                                    </td>
                                </tr>
                                @endif
                                <tr>
                                    <td>
                                        Remaining Balance: {{ $inv_row->amount_left }}
                                    </td>
                                </tr>
                                @endif
                                @if($inv_row->received_amount>0 && $inv_row->amount_left<0)
                                <tr>
                                    <td>
                                        Received: {{ $inv_row->received_amount }}
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Advance: {{ $inv_row->amount_left*-1 }}
                                    </td>
                                </tr>
                                @endif
                                @else($inv_row->amount<0)
                                <tr>
                                    <td>
                                        Crrent Advance    : {{ $inv_row->amount*-1 }}
                                    </td>
                                </tr>
                                @endif
                                <tr>
                                    <td>
                                        Bit  : {{ $inv_row->c_benefit }}
                                    </td>
                                </tr>
                            
                                <tr>
                                    <td>
                                        <b>Previous Bill History {{date('d/m/Y h:i:sa',strtotime( $inv_row['prev_invoices_details']->created_at))}}</b>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Subtotal: {{ $inv_row['prev_invoices_details']->subtotal}}
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Total   : {{ $inv_row['prev_invoices_details']->amount }}
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Received: {{ $inv_row['prev_invoices_details']->received_amount }}
                                    </td>
                                </tr>
                                @if( $inv_row['prev_invoices_details']->discount != 0)
                                    <tr>
                                    <td>
                                        Discount: {{ $inv_row['prev_invoices_details']->discount }}
                                    </td>
                                </tr>
                                @endif
                                @if($inv_row['prev_invoices_details']->amount_left>0)
                                <tr>
                                    <td>
                                        Remaining Balance: {{ $inv_row['prev_invoices_details']->amount_left }}
                                    </td>
                                </tr>
                                @elseif($inv_row['prev_invoices_details']->amount_left <= -1 && $inv_row['prev_invoices_details']->amount_left != 0)
                                <tr>
                                    <td>
                                        Advance : {{ $inv_row['prev_invoices_details']->amount_left*-1 }}
                                    </td>
                                </tr>
                                @endif
                            </tbody>
                        </table>
                        <div class="text-center"><img class=""  align="1" src="{{asset('images/qr.bmp') }}" alt="Invoice Header Image" width="auto" height="auto"/></div>
                        <p class="text-center">--------Thank You--------</p>
                    </div>
                    </div>
                    <div class="col-md-3"></div>
                </div>
                @if($loop->last)
                <br>
                @else
                <hr>
                @endif
            </div>
        </section>
        @endforeach
        <div class="border-top ">
            <div class="container">
                <div class="row">
                    <div class="col-md-12">
                        <div class="text-center padding-20px">
                        <button id="btnStatus2" onclick="window.location='printerplus://send?text='+document.getElementById('prnt').innerHTML;" onclick="btnStatus2_Click">
                        Send to Printer+
                        </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        @section('scripts')
        <script type="text/javascript">
            $("tr.statuscheck input, tr.statuscheck select, tr.statuscheck textarea").prop('disabled', true);
        </script>
        @endsection
</body>
</html>

订单详情
.border top{border top:1px solid#eee;}.padding-20px{padding:20px}
@媒体印刷品{
.hidden print{显示:无!重要;}
}
@foreach($inv_行数据)
客户名称:{{strtoupper($inv_row->Customer->user->Name)}

地址:{{$inv_行->客户->地址}

电话:{{$inv_行->客户->电话}

日期:{{Date('d/m/Y h:i:sa',strotime($inv_row->created_at))}}/票据编号:{{{$inv_row['Bill_No']}

*******************************

@foreach($inv_行['order_details']作为$inv_DETAILE)

--------------

--------------

价格:{{$inv_详情->金额/$inv_详情->单位} 单位:{{$inv_detail->Unit} 金额:{{$inv_detail->Amount} @endforeach

*******************************

小计:{{$inv_行->小计} 折扣:{{$inv_行->折扣} @如果($inv_row['prev_invoices_details']->剩余金额>0) 余额:{{$inv_行['prev_发票_明细]->金额_left} @elseif($inv_row['prev_invoices_details']->amount_leftamount_leftamount*-1} @恩迪夫 @如果($inv_行->金额>0) 总计:{{$inv_行->金额+$inv_行['prev_发票详细信息']->金额\u左-$inv_行->折扣} @如果($inv\u row->received\u amount>0&&$inv\u row->amount\u left>=0) 已收:{{$inv\u行->已收金额} @如果($inv_row->折扣!=0) 折扣:{{$inv_行->折扣} @恩迪夫 剩余余额:{{$inv\U row->金额\U left} @恩迪夫 @如果($inv_row->received_amount>0&&$inv_row->amount_leftreceived_amount} 预付款:{{$inv\u行->金额\u左*-1} @恩迪夫 @else($inv_row->amountamount*-1} @恩迪夫 位:{{$inv_行->c_福利} 以前的账单历史记录{{日期('d/m/Y h:i:sa',STROTIME($inv_行['prev_invoices_detai