Question

heyy .. je suis nouveau à php .. j'essaie de convertir une page contenant des tables imbriquées en PDF .. Ceci est la page que je dois convertir

<!DOCTYPE html>
<html>
<body>

<div style="margin-left: auto; margin-right: auto; width: 75%">  
<table width="1000" border="1" bordercolor="#500000">
<tr>
<td colspan="2" style="background-color:#500000;">
<h1 style="text-align:center;"><font color="#FFFFFF">COMPANY NAME</font></h1>
<h2 style="text-align:center;"><font color="#FFFFFF">BALANCE SHEET</font></h2>
<h3 style="text-align:center;"><font color="#FFFFFF">DATE</font></h3>
</td>
</tr>
<tr>
<th width="50%">ASSETS</th>
<th width="50%">LIABILITIES</th>
</tr>
</tr>
<tr>
<!-- <td width="480"><?php include('assets.php') ?></td>       
<td width="480">fadffd</td> -->
<td><iframe src="assets.php" frameborder="0" width="500" height="500"></iframe></td>
<td><iframe src="liabilities.php" frameborder="0" width="500" height="500"></iframe></td></tr>
<tr>
<td colspan="2" style="background-color:#500000;text-align:center;"><font color="#FFFFFF">lkfjsdgjljsglhlhfsaj</font></td>
</tr>
</table>
</div>
</body>

</html>

Ici, j'ai inclus deux tables en tant que données de table utilisant iframe .. Lorsque j'essaie de l'importer sur PDF à l'aide du code ci-dessous, les tables imbriquées ne sont pas affichées.

<?php 
include("MPDF53/MPDF53/mpdf.php");
$mpdf=new mPDF('win-1252','A4','','',15,10,16,10,10,10);//A4 page in portrait for      landscape add -L.
$mpdf->SetHeader('|Your Header here|');
$mpdf->setFooter('{PAGENO}');// Giving page number to your footer.
$mpdf->useOnlyCoreFonts = true;    // false is default
$mpdf->SetDisplayMode('fullpage');
// Buffer the following html with PHP so we can store it to a variable later
ob_start();
?>
<?php include "balancesheet.php";
//This is your php page ?>
<?php 
$html = ob_get_contents();
ob_end_clean();
// send the captured HTML from the output buffer to the mPDF class for processing
$mpdf->WriteHTML($html);
//$mpdf->SetProtection(array(), 'user', 'password'); uncomment to protect your pdf page with password.
$mpdf->Output();
exit;
?>

aide s'il vous plaît ..

Était-ce utile?

La solution

Êtes-vous sûr de vouloir utiliser MPDF?Il y a plusieurs autres options.Par exemple, DOMPDF prend en charge explicitement des tables complexes.Et vous pouvez voir d'autres options dans Cette réponse

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top