Аналогичная задача - на готовый диплом в PDF лепятся данные награжденного и факсимиле.
$css = "
div.abs {
position: absolute;
line-height: " . $font_size * 3 . "mm;
text-align: center;
}
div.main {
top: " . $prizer_box[1] . "mm;
left: " . $prizer_box[0] . "mm;
width: " . $prizer_box[2] . "mm;
}
div.year {
top: " . $year_box[1] . "mm;
left: " . $year_box[0] . "mm;
width: " . $year_box[2] . "mm;
}
p.main {
font-size: " . $font_size . "mm;
font-family: romul;
text-transform: uppercase;
}
p.user {
font-size: " . $font_size * 2 . "mm;
line-height: " . $font_size * 3 . "mm;
font-family: heinrichscript;
margin: 0 0 " . $font_size * 3 . "mm 0;
}
";
$html_text = "<div class='abs main'>";
$html_text .= "<p class='main'>Награждается</p>";
$html_text .= "<p class='user'>$name<br />$surname</p>";
$html_text .= "<p class='main'>$award_title<br />$event_title</p>";
$html_text .= "</div>";
$html_text .= "<div class='abs year'><p class='main'>$year</p></div>";
$image_path = $_SERVER['DOCUMENT_ROOT'] . '/images/diploma/';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/vendor/mpdf60/mpdf.php';
$mpdf = new mPDF();
$mpdf->img_dpi = 300;
$mpdf->SetImportUse();
$mpdf->SetSourceFile($image_path . 'Diplom_' . $diploma . '.pdf');
$tmpl = $mpdf->ImportPage();
$mpdf->UseTemplate($tmpl);
$mpdf->charset_in = 'cp1251';
$mpdf->WriteHTML($css, 1);
$mpdf->WriteHTML($html_text, 2);
$mpdf->facsimile = file_get_contents($image_path . 'facsimile_600.png');
$mpdf->Image('var: facsimile', $fac_x, $fac_y, '50%', '50%');
$mpdf->Output('diploma.pdf', 'I');