Fix watermark alpha transparency (#31535)
This commit is contained in:
parent
23722b3db8
commit
e31adc98fa
1 changed files with 8 additions and 1 deletions
|
|
@ -814,17 +814,24 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
|
|||
$watermark_x = $w / 2;
|
||||
$watermark_y = $h / 3;
|
||||
$pdf->SetFont('', 'B', 40);
|
||||
$pdf->SetTextColor(255, 192, 203);
|
||||
$pdf->SetTextColor(255, 0, 0);
|
||||
|
||||
//rotate
|
||||
$pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm', cos($watermark_angle), sin($watermark_angle), -sin($watermark_angle), cos($watermark_angle), $watermark_x * $k, ($h - $watermark_y) * $k, -$watermark_x * $k, -($h - $watermark_y) * $k));
|
||||
//print watermark
|
||||
$pdf->SetXY($watermark_x_pos, $watermark_y_pos);
|
||||
|
||||
// set alpha to semi-transparency
|
||||
$pdf->SetAlpha(0.3);
|
||||
$pdf->Cell($w - 20, 25, $outputlangs->convToOutputCharset($text), "", 2, "C", 0);
|
||||
|
||||
//antirotate
|
||||
$pdf->_out('Q');
|
||||
|
||||
$pdf->SetXY($savx, $savy);
|
||||
|
||||
// Restore alpha
|
||||
$pdf->SetAlpha(1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue