我有這個片段,在拉拉維爾,那里有一個包裝器。注意:我直接使用 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 );我的需求只是用粗體寫我的文字。我不需要更改字體文件。如何?!
1 回答

江戶川亂折騰
TA貢獻1851條經驗 獲得超5個贊
我已解決訪問基礎 FPDF 函數的問題。
回顧:拉拉維爾-mpdf是mPDF的包裝器。mPDF“包裝”并增強了少數幾個PDF處理庫之一。
這里說明:https://mpdf.github.io/:“它基于FFF和HTML2FPDF,具有許多增強功能”
有了這些信息,我只是嘗試使用FFP函數,它們就起作用了。文檔: 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();
- 1 回答
- 0 關注
- 100 瀏覽
添加回答
舉報
0/150
提交
取消