Problème d'affichage avec dompdf
agent007
-
Pitet Messages postés 2826 Date d'inscription Statut Membre Dernière intervention -
Pitet Messages postés 2826 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
Si quelqu'un pouvait m'aider , ça fait une semaine que je rencontre un problème avec dompdf. J'ai une requête SQL qui me ramène des informations, et pour les informations précise à un enregistrement , j'affiche un tableau.
Mais je reçois un problème sur le dernier tableau à afficher en PDF
"Fatal error: Call to a member function get_cellmap() on null in C:\wamp64\www\JLBExpertise-App\dompdf\vendor\dompdf\dompdf\src\FrameReflower\TableCell.php on line 37" voici le message d'erreur.
<?php
require_once 'dompdf/vendor/autoload.php';
use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
include_once("connexion.php");
if(isset($_GET['idSondage'])){
$id=$_GET['idSondage'];
//echo '1';
//Récupération des informations liées au sondage
$query="SELECT * FROM lot_sondage ls, sondage s, instruction i,chargeur c, ordre_transit ot,port_chargement pc, pays_origine po, port_dechargement pd WHERE i.idChargeur=c.idChargeur AND s.ot=ot.id_OT AND ot.idInstruction=i.id AND i.idPortChargement=pc.id_pc AND i.idPortDechargement=pd.id_pd AND ls.idSondage=s.idsondage AND s.idsondage=".$id." GROUP BY idLot";
$stmt=$pdo->query($query);
if($data=$stmt->fetch()){
//liste des lots du sondage
$req="SELECT * FROM lot_sondage WHERE idSondage=".$id;
$sth=$pdo->query($req);
while($data_lot=$sth->fetch()){
//echo "1";
?>
<style>
table,th,td {
border:1px solid black;
border-collapse: unset;
}
@media print
{
table {page-break-after:always;}
}
@page { size: 280.9134pt 191.9055pt; }
</style>
<font size="1">
<table class="table1" style ="width:25px;height:10px" align=center border=1>
<tr>
<th rowspan="2" align=center><img src="logo_jlb.png" width="70" height="50"></th>
<th colspan="2" rowspan="2" align=center><b>ETIQUETTE DE SONDAGE</b></th>
<th width=20%>Réf:ENR-LA-02</th>
</tr>
<tr >
<th width=20%>Version:02</th>
</tr>
<tr >
<td nowrap><font size="2">Campagne: <?=$data_lot['campagneLot']?></font></td>
<td nowrap colspan="4"><font size="2">OT N° : <?=$data['numeroOT']?></font></td>
</tr>
<tr >
<td nowrap><font size="2">Pays d'origine : <?=$data['libelle']?></font></td>
<td nowrap colspan="4"><font size="2">Exportateur: <?=$data['libChargeur']?></font></td>
</tr>
<tr >
<td nowrap><font size="2">Port chargement : <?=$data['lib_pc']?></font></td>
<td colspan="4"><font size="2">Marque :<?=$data['marqueProduit']?></font></td>
</tr>
<tr >
<td nowrap><font size="2">Port déchargement : <?=$data['lib_pd']?></font></td>
<td nowrap colspan="4" ><font size="2">Date : </font></td>
</tr>
<tr >
<td nowrap><font size="2">Nombre de sacs : </font></td>
<td nowrap colspan="4"><font size="2">Site: </font></td>
</tr>
<tr >
<td nowrap rowspan="2">Numéro de lot : <?=$data_lot['numeroLot']?></td>
<td nowrap colspan="4">Heure Début : </td>
</tr>
<tr >
<td nowrap colspan="4">Heure Fin : </td></br>
</tr>
</table><br>
<span style="page-break-after:always;"></span>
<?php
}
}
$html = ob_get_clean();
$dompdf->loadHtml($html);
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('portrait');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
$dompdf->stream('etiquette_sondage',array("Attachment"=> 0));
}
?>
J'ai vraiment besoin de votre aide , c'est urgent
Si quelqu'un pouvait m'aider , ça fait une semaine que je rencontre un problème avec dompdf. J'ai une requête SQL qui me ramène des informations, et pour les informations précise à un enregistrement , j'affiche un tableau.
Mais je reçois un problème sur le dernier tableau à afficher en PDF
"Fatal error: Call to a member function get_cellmap() on null in C:\wamp64\www\JLBExpertise-App\dompdf\vendor\dompdf\dompdf\src\FrameReflower\TableCell.php on line 37" voici le message d'erreur.
voici mon code php
<?php
require_once 'dompdf/vendor/autoload.php';
use Dompdf\Dompdf;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
include_once("connexion.php");
if(isset($_GET['idSondage'])){
$id=$_GET['idSondage'];
//echo '1';
//Récupération des informations liées au sondage
$query="SELECT * FROM lot_sondage ls, sondage s, instruction i,chargeur c, ordre_transit ot,port_chargement pc, pays_origine po, port_dechargement pd WHERE i.idChargeur=c.idChargeur AND s.ot=ot.id_OT AND ot.idInstruction=i.id AND i.idPortChargement=pc.id_pc AND i.idPortDechargement=pd.id_pd AND ls.idSondage=s.idsondage AND s.idsondage=".$id." GROUP BY idLot";
$stmt=$pdo->query($query);
if($data=$stmt->fetch()){
//liste des lots du sondage
$req="SELECT * FROM lot_sondage WHERE idSondage=".$id;
$sth=$pdo->query($req);
while($data_lot=$sth->fetch()){
//echo "1";
?>
<style>
table,th,td {
border:1px solid black;
border-collapse: unset;
}
@media print
{
table {page-break-after:always;}
}
@page { size: 280.9134pt 191.9055pt; }
</style>
<font size="1">
<table class="table1" style ="width:25px;height:10px" align=center border=1>
<tr>
<th rowspan="2" align=center><img src="logo_jlb.png" width="70" height="50"></th>
<th colspan="2" rowspan="2" align=center><b>ETIQUETTE DE SONDAGE</b></th>
<th width=20%>Réf:ENR-LA-02</th>
</tr>
<tr >
<th width=20%>Version:02</th>
</tr>
<tr >
<td nowrap><font size="2">Campagne: <?=$data_lot['campagneLot']?></font></td>
<td nowrap colspan="4"><font size="2">OT N° : <?=$data['numeroOT']?></font></td>
</tr>
<tr >
<td nowrap><font size="2">Pays d'origine : <?=$data['libelle']?></font></td>
<td nowrap colspan="4"><font size="2">Exportateur: <?=$data['libChargeur']?></font></td>
</tr>
<tr >
<td nowrap><font size="2">Port chargement : <?=$data['lib_pc']?></font></td>
<td colspan="4"><font size="2">Marque :<?=$data['marqueProduit']?></font></td>
</tr>
<tr >
<td nowrap><font size="2">Port déchargement : <?=$data['lib_pd']?></font></td>
<td nowrap colspan="4" ><font size="2">Date : </font></td>
</tr>
<tr >
<td nowrap><font size="2">Nombre de sacs : </font></td>
<td nowrap colspan="4"><font size="2">Site: </font></td>
</tr>
<tr >
<td nowrap rowspan="2">Numéro de lot : <?=$data_lot['numeroLot']?></td>
<td nowrap colspan="4">Heure Début : </td>
</tr>
<tr >
<td nowrap colspan="4">Heure Fin : </td></br>
</tr>
</table><br>
<span style="page-break-after:always;"></span>
<?php
}
}
$html = ob_get_clean();
$dompdf->loadHtml($html);
// (Optional) Setup the paper size and orientation
$dompdf->setPaper('portrait');
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
$dompdf->stream('etiquette_sondage',array("Attachment"=> 0));
}
?>
J'ai vraiment besoin de votre aide , c'est urgent
A voir également:
- Call to a member function get_cellmap() on null
- Affichage double ecran - Guide
- Problème affichage fenêtre windows 10 - Guide
- Windows 11 affichage classique - Guide
- Problème affichage page internet google chrome - Forum Téléphones & tablettes Android
- Pinterest problème affichage ✓ - Forum Réseaux sociaux
1 réponse
Bonjour,
Tu as une erreur de syntaxe html à la fin du tableau, ce qui doit provoquer l'erreur dans la classe TableCell de dompdf.
Juste après la dernière cellule de ton tableau, il y a un "</br>" incorrect.
Cette balise n'existe pas en html, c'est soit <br/>, soit <br>, et il ne doit pas y avoir de saut de ligne après une cellule dans un tableau html.
Tu as une erreur de syntaxe html à la fin du tableau, ce qui doit provoquer l'erreur dans la classe TableCell de dompdf.
Juste après la dernière cellule de ton tableau, il y a un "</br>" incorrect.
Cette balise n'existe pas en html, c'est soit <br/>, soit <br>, et il ne doit pas y avoir de saut de ligne après une cellule dans un tableau html.