MPDF在列之间添加垂直线

时间:2019-12-12 10:18:43

标签: php mpdf

有什么办法可以添加一条垂直线来分隔由“ columns”生成的列吗? 我尝试添加内联样式“ column-rule”,但不会在输出中显示。

谢谢。

编辑: 这是代码

public static function generatePDF()
    {
        $stylesheet = file_get_contents(public_path('css').'/pdf.css');

        $mpdf = new Mpdf([
            'tempDir' => public_path('pdf'),
            'format' => 'A4',
            'margin_left' => 17,
            'margin_right' => 17,
            'margin_top' => 20,
            'margin_bottom' => 40,
            'margin_header' => 0,
            'margin_footer' => 13,
        ]);

        $mpdf->SetDisplayMode('fullpage');
        
        $pagecount = $mpdf->SetSourceFile('./A4.pdf');
        $tplId = $mpdf->ImportPage($pagecount);
        $mpdf->SetPageTemplate($tplId);
        $mpdf->defaultfooterfontsize = 9;
        $mpdf->setFooter('Page {PAGENO}');
        $mpdf->keepColumns = true;
        $mpdf->AddPage();

        $html = '<columns column-count="2" vAlign="J" column-gap="7" class="columngap" />';
        $html .= 'somerandom long text';
        $html .= '</columns>';

        // output the HTML content
        $mpdf->WriteHTML($stylesheet, 1);
        $mpdf->writeHTML($html);

        // Close and output PDF document
        // This method has several options, check the source code documentation for more information.
        $mpdf->Output('test.pdf', 'I');
    }

我也试图将样式放入css文件中,但似乎不可能。下面是我的pdf.css文件

.columngap {
    column-rule: 2px solid red;
}

0 个答案:

没有答案