php - PHP FPDF 仅更改字体大小
问题描述
我已将所有 pdf 的字体大小设置为 10,问题是如果我想更改 pdf 特定区域的字体大小而不更改全部字体大小,可以做到吗?见下面的代码,我想改变这些区域的字体大小 $pdf->SetXY(17, 80) ;
<?php
require_once('../../bus_partners/fpdf/fpdf/fpdf.php');
require_once('../../bus_partners/fpdf/fpdi/fpdi.php');
$pageCount = $pdf->setSourceFile('../../bus_partners/BIR-forms/2316.pdf') ;
$tplIdx = $pdf->importPage(1, '/MediaBox');
$pdf->SetAutoPageBreak(false) ;
$pdf->addPage('P', 'Legal') ;
$pdf->useTemplate($tplIdx, 8, 12, 200, 320) ;
// setting the font size for the whole page
$pdf->SetFont('Arial');
$pdf->SetFontSize(9);
$pdf->SetTextColor(12, 12, 12);
// Can I set the font size in this specific area only ?
$pdf->SetXY(17, 80) ;
$pdf->Write(0, $address_ee) ;
?>
解决方案
这样做:
<?php
...
$pdf->SetFont('Arial', 'B', 14);
$pdf->SetXY(17, 80) ;
$pdf->Write(0, $address_ee) ;
...
?>
您可以在这里看到 setFont 的设置: http ://www.fpdf.org/en/doc/setfont.htm
推荐阅读
- excel - Azure 逻辑应用获取目标工作表行值
- spring - 好奇docker-compose和dockerfile的使用
- image - 将 html 转换为 odt 或 docx 时嵌入图像
- sql - Oracle - 如何处理函数错误并返回 null
- node.js - Node.js 和 Oracle DB 选择查询在行中获取空数组
- android - 列表视图中的收藏按钮问题 Flutter/Dart
- android - DJI DJICodecManager isDecoderOK() 对于矩阵 600 和未调用 onYUVDataReceived 回调始终返回 false
- powershell - 拉动 DG 的 PS 输出中的触点
- arrays - 使用c中的指针反转二维数组中的字符串数组
- macos - 构建和测试 SWIG,获取“强化程序中不允许的文件系统相对路径”