Merge remote-tracking branch 'origin/3.3' into 3.4

This commit is contained in:
Laurent Destailleur
2013-07-25 21:53:38 +02:00

View File

@@ -424,19 +424,24 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
elseif ($unit=='cm') $k=72/2.54;
elseif ($unit=='in') $k=72;
$watermark_angle=atan($h/$w);
$watermark_x=5;
$watermark_y=$h-50; // We must be sure to not print into margins
$watermark_width=$h;
$pdf->SetFont('','B',50);
$savx=$pdf->getX(); $savy=$pdf->getY();
$watermark_angle=atan($h/$w)/2;
$watermark_x_pos=0;
$watermark_y_pos=$h/3;
$watermark_x=$w/2;
$watermark_y=$h/3;
$pdf->SetFont('','B',40);
$pdf->SetTextColor(255,192,203);
//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,$watermark_y);
$pdf->Cell($watermark_width,25,$outputlangs->convToOutputCharset($text),0,2,"C",0);
$pdf->SetXY($watermark_x_pos,$watermark_y_pos);
$pdf->Cell($w-20,25,$outputlangs->convToOutputCharset($text),"",2,"C",0);
//antirotate
$pdf->_out('Q');
$pdf->SetXY($savx,$savy);
}