<?php
//$headerTag
//$item
//$hasMoreRemark
//$make
//$models
//$fontBold
//$font
//$include

$headCfg = $this->modelHeader[$headerTag];
$fname = md5(json_encode($item)) . '.png';
$outfilename = $this->tmpDir . '/' . $fname;
$outurl = \mvc::$cfg['path']['cache'] . '/tmp_pdf_ss/' . $fname;
if ($row > 1) {
    $row = $this->setBreak($sheet, $row - 1, 'Header') + 1;
}
$this->insertModelHeaderText($sheet, $row, $item);
$this->setBgColor($sheet, $row, 'FFFFFF');

//if (!file_exists($outfilename)) {
$image = imagecreatefrompng($headCfg['filename']);
$white = imagecolorallocate($image, 255, 255, 255);
if ($hasMoreRemark) {
}
$angle = 0;
//make
$fontSize = 50;
$size = $this->imageTextSize($fontSize, $angle, $fontBold, $make);
$x = 290;
$y = 20 + $size['height'];
$y = 70;
imagettftext($image, $fontSize, 0, $x, $y, $white, $fontBold, $make);


//1
$x = 280;
$y = 91;
$areaHeight = 87;
$targetWidth = 2000;
$this->insertTextFitWidthByImage($targetWidth, $angle, $font, $models[0], $image, $x, $y, $areaHeight);

//
imagepng($image, $outfilename, 0);
imagedestroy($image);


$this->insertImage($sheet, $outfilename, $headCfg['width'], $headCfg['height'], $col, $row, 0, 10); // y=5
$this->setRowHeight($sheet, $row, $headCfg['height'] * PT_SALC + 25); // 15
$isBreak = $this->addRowNum($sheet, 'Header');

//echo '<img src="' . $outurl . '">';
//exit;
