(mPDF ≥ 1.0)
SetAlpha – Set the opacity for Images
voidSetAlpha ( float$alpha [, string$blend ])
Set the opacity and blend mode for Images
This parameter specifies the opacity for any subsequent images written to the current document.
Values
Float:0 (transparent) to1 (opaque)
This parameter specifies the blend mode.
Values
One of the following strings:
'Normal''Multiply''Screen''Overlay''Darken''Lighten''ColorDodge''ColorBurn''HardLight''SoftLight''Difference''Exclusion''Hue''Saturation''Color''Luminosity'Default:'Normal'
| Version | Description |
|---|---|
| 1.0 | Function was added. |
Example #1
<?php// Require composer autoloadrequire_once__DIR__.'/vendor/autoload.php';$mpdf=new\Mpdf\Mpdf();$mpdf->SetAlpha(0.5);$mpdf->WriteHTML('<img src="clematis.jpg" />');$mpdf->SetAlpha(1);// This produces the identical result as the last 3 lines// $mpdf->WriteHTML('<img src="clematis.jpg" opacity="0.5" />');$mpdf->Output();exit;