我在表格行跨度的 pdf 视图中遇到错误

问题描述 投票:0回答:1

表格更改为 pdf 中的新页面后,行跨度不起作用 我使用 laravel-dompdf 获取 pdf

pdf 中的表格视图

我的桌子代码

<table class="table-sm text-center align-middle">

        <tr>

            <th rowspan="2">NAMA PASANGAN CALON</th>
            <th colspan="15">Rincian Perolehan Suara</th>
            <th rowspan="2">Jumlah <br> Tiap <br> Baris</th>
            <th rowspan="2">Jumlah</th>

        </tr>
        <tr>
            @for ($i = 1; $i <= 15; $i++)
                <td>{{ $i }}</td>
            @endfor
        </tr>
        @for ($c = 0; $c < 3; $c++)
            @for ($i = 1; $i <= 11; $i++)
                <tr>
                    @if ($i === 1)
                        <td rowspan="11">asdkjhasdkjhasdkjhasdjhsjahd and asdjaksdkasdkjkasdjh</td>
                    @endif
                    @for ($j = 1; $j <= 15; $j++)
                        <td>{{ str_repeat('|', 5) }}</td>
                    @endfor
                    <td>{{ 5 * 15 }}</td>
                    @if ($i === 1)
                        <td class="align-top" rowspan="11">{{ 5 * 15 * 11 }}</td>
                    @endif
                </tr>
            @endfor
        @endfor



    </table>

我希望表格的结果是这样的 在此输入图片描述

laravel pdf
1个回答
0
投票

2解决方案,缩小你的内容或者放大你的纸张尺寸

此参考资料将帮助您 = 如何使用 dompdf 设置 pdf 的自定义宽度和高度?

//add this
$customPaper = array(0,0,360,360);
$dompdf->setPaper($customPaper);

自行设置自定义分辨率/纸张尺寸。自己尝试一下您需要的尺寸。这只是示例。

或者也许这会对你有帮助

border-spacing: -1px;

此处供参考= https://github.com/dompdf/dompdf/issues/1284

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.