besoin d'aide sur html2pdf

Cafeine

Cafeine Le 13 septembre 2017 à 22:06 (Édité le 25 janvier 2019 à 17:54)

<?php
session_start();
include_once("connect_bdd.php");
ob_start();
?>
<style type="text/css">
    img {
        border: 0;
    }
    table {
        border-collapse: collapse;
        border-spacing: 0;
    }
    td,
    th {
        padding: 0;
    }
    p {
        margin: 0em 0em 1em;
        line-height: 1.4285em;
    }
    p:first-child {
        margin-top: 0em;
    }
    p:last-child {
        margin-bottom: 0em;
    }
    .peniel {
        color: black;
        text-align: center;
    }
</style>
<page backtop="7mm" backbottom="7mm" backleft="7mm" backright="7mm">
    <page_footer>
        <p style="text-align:right;margin-right: 15%">Rétiré le:<?php echo date('d/m/y') ?> à <?= date(' G:i:s') ?></p>
    </page_footer>
    <div style="width: 48%;height:8%;">
        <p style="margin-top:1px;line-height: 2px" class="peniel">REPUBLIQUE DE COTE D'IVOIRE</p>
        <p style="margin-top:1px;line-height: 2px" class="peniel">MINISTERE DE L'EDUCATION NATIONALE</p>
        <p style="margin-top:1px;line-height: 2px" class="peniel">DREN : ABIDJAN 1</p><br/>
        <div style="height: 1%;width:250px;color:black;border:1px solid black;margin-left: 45px;margin-top: -5px;border-radius: 2px;text-align: center">
            <?php
            $vue_etab = $bdd->query("SELECT * FROM etablissement");
            $vue_etabs = $vue_etab->fetch(); ?>
            <strong class="peniel"><?= $vue_etabs['lib_etab'] ?> EPP PAILLER 2</strong>
        </div>
    </div>
    <div style="width: 48%;margin-left: 350px;margin-top: -78px;">
        <p>
            Code Etablissement:                        
            Statut:
        </p>
        <p>
            Tél : <?= $vue_etabs['tel_etab'] . '/' . $vue_etabs['tel_etab2'] . '/' . $vue_etabs['tel_etab3']; ?>
        </p>
        <p>
            E-mail :<?= $vue_etabs['email_etab'] ?>
        </p>
    </div>
    <br/>
    <div style="height:30px;width:100%;background:black;">
        <p style="color:white;margin-top:5px;font-size:20px;text-align: center">
            BULLETIN DE NOTES : Premier Trimestre – Année scolaire : <?= date('Y') . ' - ' . date('Y', strtotime('+1 year')) ?>
        </p>
    </div>
    <br/>
    <?php
    //recupération de l'id de l'eleve en cour
    $recup_idE = htmlspecialchars($_GET['idE']);
    //$vue_elev = $bdd->query("SELECT * FROM eleve");
    $vue_class = $bdd->query("SELECT * FROM classe,eleve WHERE classe.id_class = eleve.id_class AND eleve.id_elev = $recup_idE ");
    //$vues_info_moy_class = $vue_class->fetch();
    $id_class = 0;

    while ($vues_info_moys_class = $vue_class->fetch()) {
        $id_class = $vues_info_moys_class['id_class']; ?>
        <div style="border-radius:5px;height:160px;width: 98%;">
            <p>Nom et
                Prénom: <?= ucfirst($vues_info_moys_class['nom_elev']) . ' ' . ucfirst($vues_info_moys_class['prenom_elev']) ?></p>
            <p>Classe: <?= $vues_info_moys_class['lib_class']; ?>
                                  
                                    Effectif de la classe: <?php $req = $bdd->query("SELECT * FROM eleve WHERE eleve.id_class = $id_class");
                $count_elev = $req->rowCount(); echo $count_elev; ?></p>
            <p>Sexe: <?= $vues_info_moys_class['sexe_elev'] ?>      
                                           
                Rédoublant (e): <?= $vues_info_moys_class['statut_elev'] ?></p>
            <p>Nationnalité: <?= $vues_info_moys_class['nationalite_elev'] ?>
                                 
                Matricule Peniel: <?= $vues_info_moys_class['matricule_elev'] ?>
            </p>
            <p>Né (e) le : <?= $vues_info_moys_class['date_naiss_elev'] ?>
                                  
                à
                          <?= strtoupper($vues_info_moys_class['lieu_naiss_elev']) ?>
            </p>
        </div>
        <div style="border-radius:5px">
            <img src="avatar_eleve/<?= $vues_info_moys_class['photo_elev'] ?>" alt="test" class="peniel"
                 style="width:15%;height:100px;margin-left: 540px;margin-top: -145px;border:1px solid black;position: relative;"/>
        </div>
    <?php } ?>
    <?php
    //recupération de l'id de l'eleve en cour
    $recup_idE = htmlspecialchars($_GET['idE']);
    include 'fonct_peniel.php';
    ?>
    <table class="ui celled responsive definition table">
        <thead>
        <tr>
            <th style="font-weight:bold;border: 1px solid;;text-align: center">MATIERES</th>
            <th style="border: 1px solid;text-align: center;height: 20px;width: 85px">Moyenne</th>
            <th style="border: 1px solid;text-align: center;height: 20px;width: 85px">Coefficient</th>
            <th style="border: 1px solid;text-align: center;height: 20px;width: 85px">Moy * Coeff</th>
            <th style="border: 1px solid;text-align: center;height: 20px;width: 85px">Rang</th>
            <th style="border: 1px solid;text-align: center;height: 20px">Appréciation/Emargement</th>
        </tr>
        </thead>
        <tbody>
        <?php
        //die(calcul_moy_matiere($recup_idE, $bdd));
        $table = calcul_moy_matiere($recup_idE, $bdd);
        $cat_tables = calcul_cat_matiere($table, $bdd, $recup_idE, $id_class);
        foreach ($cat_tables as $cat_table):
            foreach ($table as $moy_matiere):
                if ($moy_matiere['cat_mat'] == $cat_table['id_cat_mat']):
                    ?>
                    <tr>
                        <td style="border: 1px solid;height: 20px;text-align:center"><?= $moy_matiere['matiere']; ?></td>
                        <td style="border: 1px solid;height: 20px;text-align:center"><?= $moy_matiere['moy']; ?></td>
                        <td style="border: 1px solid;height: 20px;text-align:center"><?= $moy_matiere['coeff']; ?></td>
                        <td style="border: 1px solid;height: 20px;text-align:center"><?= $moy_matiere['moy_coeff']; ?></td>
                        <td style="border: 1px solid;height: 20px;text-align:center"><?= $moy_matiere['rang']; ?></td>
                        <td style="border: 1px solid;height: 20px;text-align:center"><?= $moy_matiere['appreciation']; ?></td>
                    </tr>
                    <?php
                endif;
            endforeach;
            $bil_mat = calcul_moy_par_eleve($id_class, $bdd, $cat_table['id_cat_mat'], $recup_idE, $cat_table['bilan_moy_coeff']);
            ?>
            <tr>
                <td style="border: 1px solid;height: 20px"><b><?= $cat_table['lib_cat_mat'] ?></b></td>
                <td style="border: 1px solid;height: 20px;text-align:center">
                    <b><?= $cat_table['bilan_moy_coeff'] ?></b></td>
                <td style="border: 1px solid;height: 20px;text-align:center">
                    <b><?= $cat_table['som_coeff_cat_mat'] ?></b></td>
                <td style="border: 1px solid;height: 20px;text-align:center">
                    <b><?= $cat_table['som_moy_cat_mat'] ?></b></td>
                <td style="border: 1px solid;height: 20px;text-align:center"><b><?= $bil_mat['rang'] ?></b></td>
                <td style="border: 1px solid;height: 20px;text-align:center"><b><?= $bil_mat['appreciation'] ?></b>
                </td>
            </tr>
        <?php endforeach; ?>
        <tr>
            <td style="border: 1px solid;height: 20px" colspan="2"></td>
            <?php $moy_trim = calcul_moy_trim($id_class, $bdd, $recup_idE) ?>
            <td style="border: 1px solid;height: 20px;text-align:center">
                <strong><?= $moy_trim["coeff_tot"] ?></strong></td>
            <td style="border: 1px solid;height: 20px;text-align:center">
                <strong><?= $moy_trim["som_moy_coeff"] ?></strong></td>
            <td style="border: 1px solid;height: 20px;text-align:center" colspan="2"><b style="text-align: right">MOY.
                    TRIM : </b><strong><?= $moy_trim["moyenne_trimestrielle"] ?></strong><i><strong>
                        Rang <?= $moy_trim["rang"] ?>/ <?= $moy_trim["effectif_elev_tot"] ?> </strong></i></td>
        </tr>
        <tr>
            <td colspan="6"
                style="text-align:center;height: 20px;border: 1px solid;background: whitesmoke;font-weight:bold">
                Absences justifiées : Heure(s) Absences non justifiées : 00 Heure(s)
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align:center;background: whitesmoke;border: 1px solid;font-weight:bold">
                Résultats Trimestriel
            </td>
            <td colspan="2"
                style="text-align:center;background: whitesmoke;border: 1px solid;font-weight:bold;width: 220px">
                Distinctions
            </td>
            <td colspan="2"
                style="text-align:center;background: whitesmoke;border: 1px solid;font-weight:bold;width: 40px">
                Sanctions
            </td>
        </tr>
        <?php $rangement = rangement_moyenne($id_class, $bdd, $recup_idE); ?>
        <tr style="height: 200px">
            <td colspan="2" style="text-align:left;height: 70px;border: solid black;">Plus forte moyenne
                :<b><?= $rangement['moyenne_forte'] ?></b> <br/><br/>Plus faible moyenne
                :<b><?= $rangement['moyenne_faible'] ?></b> <br/><br/>Moyenne Classe : <b><?= $rangement['moyenne_classe'] ?></b>
            </td>
            <td colspan="2" style="height: 70px;border: solid black">
                <div style="width: 30px;height: 20px;border: 1px solid black"></div>
                Tableau d’honneur<br/>
                <div style="width: 30px;height: 20px;border: 1px solid black;display: inline"></div>
                <span style="font-size: 8px;display: inline">Tableau d’honneur + Encouragent</span> <br/>
                <div style="width: 30px;height: 20px;border: 1px solid black"></div>
                Tableau d’honneur + Félicitations
            </td>
            <td colspan="2" style="text-align:left;height: 70px;border: solid black">
                <div style="width: 30px;height: 20px;border: 1px solid black"></div>
                Avertissement pour travail insuffisant<br/>
                <div style="width: 30px;height: 20px;border: 1px solid black"></div>
                Avertissement pour travail insuffisant <br/>
                <div style="width: 30px;height: 20px;border: 1px solid black"></div>
                Avertissement pour mauvaise conduite
            </td>
        </tr>
        <tr>
            <td colspan="4" style="background: white;text-align: center;border: 1px solid;font-weight:bold">
                Appreciation du Conseil de classe
            </td>
            <td colspan="2" style="background: white;text-align: center;border: 1px solid;font-weight:bold">Visa du
                Directeur des Etudes
            </td>
        </tr>
        <tr style="height: 200px">
            <td colspan="4" style="height: 90px;border: solid black"></td>
            <td colspan="2" style="height: 90px;border: solid black"></td>
        </tr>
        </tbody>
    </table>
    <p style="text-align: center;font-weight: bold">NB : Conserver bien ce document, en cas de perte aucun duplicata
        ne vous sera rémis.</p>
</page>
<?php
$content = ob_get_clean();
require("html2pdf_v4.03/html2pdf_v4.03/html2pdf.class.php");
try {
$pdf = new HTML2PDF('P', 'A4', 'fr', 'true', 'UTF-8');
$pdf->pdf->SetDisplayMode('fullpage');
$pdf->writeHTML($content);
$pdf->Output('bulletin.pdf');
} catch (HTML2PDF_exception $e) {
die($e);
}
?>
salut a tous svp j'ai besoin de votre aide avec mon html2pdf car il génère une page blanche automatique mon code se trouve ci-dessus merci
Vous devez être connecté pour poster une réponse. Se connecter ou Créer un compte