输出的 PDF 数据无法正常显示,对齐方式为右对齐。

作者: Moix1创建于 2024年6月27日更新于 2026年2月4日
标签stale

My Codes

This Page/View Receiving Data

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>PDF Report</title>
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
    <style>
        html, body {
            width: 100%;
            height: 100%;
            padding: 0;
            margin: 0;
        }
        .container {
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }
        .table {
            width: 100%;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1 class="text-center mb-4">Shipment Report</h1>
        <div class="table-responsive">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th>Date</th>
                        <th>Waybill No</th>
                        <th>Tracking No</th>
                        <th>Destination</th>
                        <th>Packages</th>
                        <th>Total Weight</th>
                        <th>Volumetric Weight</th>
                        <th>Total Charges</th>
                        <th>Shipment Type</th>
                        <th>Service Type</th>
                        <th>Receiver Name</th>
                        <th>Extra Charges</th>
                        <th>Remark</th>
                        <th>Debit</th>
                        <th>Credit</th>
                        <th>Total Balance</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($data as $item)
                        <tr>
                            <td>{{ $item['date'] }}</td>
                            <td>{{ $item['waybill_no'] }}</td>
                            <td>{{ $item['tracking_no'] }}</td>
                            <td>{{ $item['destination'] }}</td>
                            <td>{{ $item['packages'] }}</td>
                            <td>{{ $item['total_weight'] }}</td>
                            <td>{{ $item['volumetric_weight'] }}</td>
                            <td>{{ $item['total_charges'] }}</td>
                            <td>{{ $item['shipment_type'] }}</td>
                            <td>{{ $item['service_type'] }}</td>
                            <td>{{ $item['receiver_name'] }}</td>
                            <td>{{ $item['extra_charges'] }}</td>
                            <td>{{ $item['remark'] }}</td>
                            <td>{{ $item['debit'] }}</td>
                            <td>{{ $item['credit'] }}</td>
                            <td>{{ $item['total_balance'] }}</td>
                        </tr>
                    @endforeach
…

内容来源: barryvdh/laravel-dompdf