production/Controleur/Editions/etats_avenants/editiontest.php
2025-12-01 16:12:12 +00:00

51 lines
1.2 KiB
PHP

<?php
class PDF extends FPDF_Protection {
function Header() {
$this->SetFont('Arial', 'B', 12);
$this->Cell(190, 10, 'Country Information', 0, 1, 'C');
$this->Ln(10);
}
function Footer() {
$this->SetY(-15);
$this->SetFont('Arial', 'I', 8);
$this->Cell(0, 10, 'Page ' . $this->PageNo(), 0, 0, 'C');
}
function CreateTable($header, $data) {
// Table header
$this->SetFont('Arial', 'B', 10);
foreach ($header as $col) {
$this->Cell(45, 10, $col, 1);
}
$this->Ln();
// Table data
$this->SetFont('Arial', '', 10);
foreach ($data as $row) {
foreach ($row as $col) {
$this->Cell(45, 10, $col, 1);
}
$this->Ln();
}
}
}
// Example data
$header = array('Country', 'Capital', 'Area (km²)', 'Population (millions)');
$pdf = new FPDF_Protection();
$pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES');
$userPassword = '';
$ownerPassword = null;
$pdf->SetProtection(['print'], $userPassword, $ownerPassword);
$pdf->AddPage();
$pdf->CreateTable($header, $data);
require("piedfacturetest.php");