-
Notifications
You must be signed in to change notification settings - Fork 0
/
certificates.php
38 lines (28 loc) · 1.16 KB
/
certificates.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
$dbc = mysqli_connect('localhost', 'root', '', 'registr_database');
require_once('fpdf/fpdf.php');
require_once('fpdf/fpdi.php');
$result = mysqli_query($dbc, "SELECT * FROM registered_people ORDER BY university");
// initiate FPDI
$pdf = new FPDI();
// $pageCount = $pdf->setSourceFile("fpdf/certificate1.pdf");
$pageCount = $pdf->setSourceFile("fpdf/certificate2.pdf");
/* <Virtual loop> */
while ($row = mysqli_fetch_array($result)) {
$pdf->AddPage();
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx, null, null, 0, 0, true);
$pdf->SetY(50);
$pdf->SetFont('Arial', '', 30);
$pdf->SetTextColor(30, 30, 30);
$name = $row['full_name'];
// now write some text above the imported page
//Text configuration for certificate1.pdf
/*$height = 125;
$pdf->Cell(240, $height, utf8_decode(ucwords(strtolower($name))), 0, 0, 'C');*/
//Text configuration for certificate2.pdf
$height = 120;
$pdf->Cell(0, $height, utf8_decode(ucwords(strtolower($name))), 0, 0, 'C');
}
$pdf->Output();
?>