Ganesh Radhakrishnan Ganesh Radhakrishnan - 3 years ago 132
PHP Question

mpdf watermark - inclined to vertical

I am using mpdf to generate a report in my project. In the report i have to place a watermark. I have placed it using some codes. But the watermark i have got it aligned as 45 degree (do know exactly how much inclined). I want it aligned vertical (90 degree).

$mpdf->SetWatermarkText('DUMMY');
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->showWatermarkText = true;
$mpdf->watermarkTextAlpha = 0.15;


the above code is what i used.

Does anybody know how to make it vertical?

Answer Source

In current RC of mPDF version 7.0, this can be achieved with watermarkAngle configuration variable. You can either set it in the constructor

$mpdf = new \Mpdf\Mpdf(['watermarkAngle' => 33]);

or you can set it as the instance property:

$mpdf = new \Mpdf\Mpdf();
$mpdf->watermarkAngle = 33;

Up to version 6.1.* this can be achieved only by altering mPDF source code. Somewhere along line 15724 (in version 6.1.3) in mpdf.php find line

$this->watermark($this->watermarkText, 45, 120, $this->watermarkTextAlpha);

and change 45 to whatever angle you want.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download