Merge remote-tracking branch 'origin/3.3' into 3.4
This commit is contained in:
commit
fe079f71da
@ -424,19 +424,24 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
|
|||||||
elseif ($unit=='cm') $k=72/2.54;
|
elseif ($unit=='cm') $k=72/2.54;
|
||||||
elseif ($unit=='in') $k=72;
|
elseif ($unit=='in') $k=72;
|
||||||
|
|
||||||
$watermark_angle=atan($h/$w);
|
$savx=$pdf->getX(); $savy=$pdf->getY();
|
||||||
$watermark_x=5;
|
|
||||||
$watermark_y=$h-50; // We must be sure to not print into margins
|
$watermark_angle=atan($h/$w)/2;
|
||||||
$watermark_width=$h;
|
$watermark_x_pos=0;
|
||||||
$pdf->SetFont('','B',50);
|
$watermark_y_pos=$h/3;
|
||||||
|
$watermark_x=$w/2;
|
||||||
|
$watermark_y=$h/3;
|
||||||
|
$pdf->SetFont('','B',40);
|
||||||
$pdf->SetTextColor(255,192,203);
|
$pdf->SetTextColor(255,192,203);
|
||||||
//rotate
|
//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));
|
$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
|
//print watermark
|
||||||
$pdf->SetXY($watermark_x,$watermark_y);
|
$pdf->SetXY($watermark_x_pos,$watermark_y_pos);
|
||||||
$pdf->Cell($watermark_width,25,$outputlangs->convToOutputCharset($text),0,2,"C",0);
|
$pdf->Cell($w-20,25,$outputlangs->convToOutputCharset($text),"",2,"C",0);
|
||||||
//antirotate
|
//antirotate
|
||||||
$pdf->_out('Q');
|
$pdf->_out('Q');
|
||||||
|
|
||||||
|
$pdf->SetXY($savx,$savy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user