Skip to content
Snippets Groups Projects
Commit 16d530b2 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Watermark make pagebreak crazy.

parent 7cf429d2
No related branches found
No related tags found
No related merge requests found
......@@ -407,19 +407,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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment