我正在使用FPDF和PHP将图像添加到PDF.但是PDF中的图像质量比原始图像差得多,如下所示:

相关代码:
$image_height = 40;
$image_width = 40;
$pdf = new FPDF();
$pdf->AddPage();
$start_x = $pdf->GetX();
$start_y = $pdf->GetY();
$pdf->Image('./images/ds_pexeso_ros_0_17.jpg', $pdf->GetX(), $pdf->GetY(), $image_height, $image_width);
$pdf->Output("pexeso".date("Y-m-d"),"I");
Run Code Online (Sandbox Code Playgroud)
原始图像为150x150像素.
我想将图像居中mpdf(版本 6>)。
这是我发送到 mpdf 的(缩短的)html 输出。该displayed班没有帮助。
<style>
IMG.displayed {
display: block;
margin-left: auto;
margin-right: auto }
</style>
<img style="max-height:600px" class="displayed" src="/images/size_original/m_princezna_1.jpg"/>
Run Code Online (Sandbox Code Playgroud)