mPDF:如何使用粗体文本使用 WriteCell 函数?

mPDF: How to use WriteCell function using bold text?

我在 Laravel 中有这个片段,其中有一个包装器。注意我直接使用 mPDF,而不是包装函数

    $pdf = new MPdf();
    $mpdf = $pdf->getMpdf();
    $mpdf->SetSourceFile(public_path() . DIRECTORY_SEPARATOR  . 'pdf' . DIRECTORY_SEPARATOR   . 'my_template.pdf');
    $template = $mpdf->ImportPage(1);
    $mpdf->UseTemplate($template);
    $mpdf->WriteCell(130,140, $text_to_write );

我的需要是简单地用粗体写我的文字。我永远不需要更改字体文件。

怎么办?!

我解决了访问底层 FPDF 函数的问题。

Recap: Laravel-mpdf is a wrapper for mPDF. mPDF 'wraps' and enhance one of a few pdf handling libraries.

此处说明:https://mpdf.github.io/ : "It is based on FPDF and HTML2FPDF with a number of enhancements"

有了这些信息,我只是尝试使用 FPDF 函数,它们起作用了。 FPDF 文档:http://www.fpdf.org/en/doc

片段

    $pdf = new MPdf();
    $mpdf = $pdf->getMpdf();
    $mpdf->SetSourceFile('name_and_path_of_template_file.pdf');
    $template = $mpdf->ImportPage(1);
    $mpdf->UseTemplate($template);
    $mpdf->SetFont('Arial','B', 11);

    $mpdf->WriteText(11,82, $what_to_write_in_bold );

    $mpdf->SetFont('Arial','', 10);

    $mpdf->WriteText(164, 243.46, $what_to_write_in_noraml);

    $mpdf->Output();