超过梯度时 Tcpdf 多单元格边框丢失
Tcpdf multiCell border's missing when over gradient
如何在渐变上使用带有边框的 MultiCell?
请注意,如果您使用单元格,则会显示边框。
// set colors for gradients (r,g,b) or (grey 0-255)
$red = array(255, 0, 0);
$blue = array(0, 0, 200);
$yellow = array(255, 255, 0);
$green = array(0, 255, 0);
$white = array(255);
$black = array(0);
// set the coordinates x1,y1,x2,y2 of the gradient (see linear_gradient_coords.jpg)
$coords = array(0, 0, 1, 0);
// paint a linear gradient
$pdf->LinearGradient(20, 45, 80, 80, $red, $blue, $coords);
// write label
$pdf->MultiCell(100, 100, 'LinearGradient()', 1);
根据 Nicola 本身 (https://sourceforge.net/p/tcpdf/bugs/236/) "this is wanted behaviour"。
在梯度和多细胞之间添加$pdf->setPageMark()
。
// paint a linear gradient
$pdf->LinearGradient(20, 45, 80, 80, $red, $blue, $coords);
$pdf->setPageMark();
// write label
$pdf->MultiCell(100, 100, 'LinearGradient()', 1);
此外,通过 setPageMark
文档块:
Set start-writing mark on current page stream used to put borders and fills. Borders and fills are always created after content and inserted on the position marked by this method. This function must be called after calling Image() function for a background image. Background images must be always inserted before calling Multicell() or WriteHTMLCell() or WriteHTML() functions.
如何在渐变上使用带有边框的 MultiCell?
请注意,如果您使用单元格,则会显示边框。
// set colors for gradients (r,g,b) or (grey 0-255)
$red = array(255, 0, 0);
$blue = array(0, 0, 200);
$yellow = array(255, 255, 0);
$green = array(0, 255, 0);
$white = array(255);
$black = array(0);
// set the coordinates x1,y1,x2,y2 of the gradient (see linear_gradient_coords.jpg)
$coords = array(0, 0, 1, 0);
// paint a linear gradient
$pdf->LinearGradient(20, 45, 80, 80, $red, $blue, $coords);
// write label
$pdf->MultiCell(100, 100, 'LinearGradient()', 1);
根据 Nicola 本身 (https://sourceforge.net/p/tcpdf/bugs/236/) "this is wanted behaviour"。
在梯度和多细胞之间添加$pdf->setPageMark()
。
// paint a linear gradient
$pdf->LinearGradient(20, 45, 80, 80, $red, $blue, $coords);
$pdf->setPageMark();
// write label
$pdf->MultiCell(100, 100, 'LinearGradient()', 1);
此外,通过 setPageMark
文档块:
Set start-writing mark on current page stream used to put borders and fills. Borders and fills are always created after content and inserted on the position marked by this method. This function must be called after calling Image() function for a background image. Background images must be always inserted before calling Multicell() or WriteHTMLCell() or WriteHTML() functions.