Answer the question
In order to leave comments, you need to log in
PDF editing with JavaScript or PHP?
Hey!
There is a pdf file and html form.
In the html form, I specify the necessary data, click save and a link appears to download the finished pdf file.
How can this be organized?
Is it better to download the pdfMake plugin on JS or is there a short code?
Answer the question
In order to leave comments, you need to log in
A similar task - the data of the recipient and facsimile are molded onto the finished diploma in 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');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question