Sairam Duggi
Sairam Duggi

Reputation: 165

Cannot create a multiple polygon in tcpdf

I am using tcpdf to create a pdf using php and mysql, i have successfully created one polygon using below code but when am trying to create the second polygon it is unable to create and the previous polygon also disappears

How to create the multiple polygons?

First Polygon

$pdf->StarPolygon(94, 110, 39, 90, 3, 0, 1, 'CNZ');
$pdf->SetLineStyle( array( 'width' => 1, 'color' => array(145,191,56)));
$pdf->Image('@'.$imgdata1, 50, 70, 90, 90, '', '', 'C', false, 300, '', false, false, 0, false, false, false);
$pdf->StopTransform();

Second Polygon

$pdf->StarPolygon(147, 58, 29, 90, 3, 0, 1, 'CNZ');
$pdf->SetLineStyle( array( 'width' => 1, 'color' => array(145,191,56)));
$pdf->Image('@'.$imgdata2, 25, 130, 70, 60, '', '', 'R', false, 300, '', false, false, 0, false, false, false);
$pdf->StopTransform();

Upvotes: 0

Views: 125

Answers (1)

Ivan
Ivan

Reputation: 2579

You should add StartTransform before code for second polygon:

// Secodn polygon
$pdf->StartTransform();
$pdf->StarPolygon(147, 58, 29, 90, 3, 0, 1, 'CNZ');
$pdf->SetLineStyle( array( 'width' => 1, 'color' => array(145,191,56)));
$pdf->Image('@'.$imgdata2, 25, 130, 70, 60, '', '', 'R', false, 300, '', false, false, 0, false, false, false);
$pdf->StopTransform();

Upvotes: 1

Related Questions