Domanda

heyy .. Io sono nuovo a php .. Sto cercando di convertire una pagina contenente tabelle nidificate in PDF .. Questa è la pagina che ho bisogno di convertire

<!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>
.

Qui ho incluso due tabelle come dati della tabella utilizzando IFRAME .. Quando provo a importarlo su PDF utilizzando il codice mostrato di seguito, le tabelle nidificate non vengono visualizzate.

<?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;
?>
.

Aiuta ..

È stato utile?

Soluzione

Sei sicuro di voler usare MPDF?Ci sono molte altre opzioni.Ad esempio, DOMPDF supporta esplicitamente tabelle complesse.E puoi vedere alcune altre opzioni in Questa risposta

.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top