[phpToPDF] Le html avec phptopdf
Salut a tous; j'ai un grave pb avec l'utilisation de la lib phptopdf.
j'ai un projet et j'aimerai générer un PDF a partir d'une requête dans une BD mysql. cette requête sélectionne tous les enregistrements sur un client, la commande passée et affiche le résultat dans la même page (formulaire html). Mon problème c'est de générer cette même page html/php en un doc PDF avec phptopdf ou fpdf.
voici le code du formulaire aider moi à intégrer la lib phptopdf ou fpdf pour générer mon doc pdf.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
| <?php
include('includes/mysql_connect.php');
$sql0="SELECT * FROM pw_commande";
$result0=mysql_query($sql0);
$n=mysql_num_rows($result0);
$sql="SELECT * FROM pw_commande where ID='$n'";
$result=mysql_query($sql);
$commande=mysql_fetch_array($result);
$sql3="SELECT * FROM pw_client WHERE codecl='$commande[IDclient]'";
$result3=mysql_query($sql3);
$client=mysql_fetch_array($result3);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Bon à payer</title>
<link href="css/print_css.css" rel="stylesheet" type="text/css" media="ALL" />
</head>
<body>
<div id="wrapper">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" align="center"><img src="images/pwb_logo.jpg" alt="PromoWeb" width="342" height="107" longdesc="http://www.promowebsa.net" /></td>
<td width="50%" align="center"><img src="images/futurex.jpg" alt="FUTUREX" width="146" height="75" longdesc="http://www.futurexing.com" /></td>
</tr>
</table>
<p class="contacts">Adress : Avenue Kennedy, Yaoundé | Tél. : 22237273<br />
http://www.promowebsa.net
</p>
<h3>BON A PAYER
</h3>
<table width="100%" cellpadding="2" cellspacing="2" class="num-date">
<tr>
<td width="50%" class="num"><?php echo "Numéro : ".$commande["ID"];?></td>
<td width="50%" class="date"><?php echo "Le ".date("d/m/Y h:m:s",$commande["date"]);?></td>
</tr>
</table>
<table width="775" cellpadding="2" cellspacing="2" class="content">
<tr>
<td width="140">Devise</td>
<td colspan="2"><span class="information">: <strong>XAF Franc CFA (Zone BEAC)</strong> </span></td>
<td width="249"> </td>
</tr>
<tr>
<td>Client</td>
<td colspan="3"><span class="information">: <?php echo "".$client["nomcl"]." ".$client["prenomcl"];?> </span></td>
</tr>
<tr>
<td>Téléphone</td>
<td><span class="information">: <?php echo "".$client["telephone"];?> </span></td>
<td width="120">e-mail</td>
<td><span class="information">: <?php echo "".$client["email"];?> </span></td>
</tr>
<tr>
<td>Produit</td>
<td><span class="information">: <?php echo "".$commande["produit"];?> </span></td>
<td>Marque</td>
<td><span class="information">: <?php echo "".$commande["marque"];?> </span></td>
</tr>
<tr>
<td height="50">Précision</td>
<td colspan="2" valign="top"><span class="information">: <?php echo "".$commande["detail"];?> </span></td>
<td> </td>
</tr>
<tr>
<td>URL</td>
<td colspan="3"><span class="information">: <?php echo "".$commande["url"];?> </span></td>
</tr>
<tr>
<td>Montant à payer </td>
<td><span class="information">: <?php echo "".$commande["prixpromoweb"];?> </span></td>
<td>Avance</td>
<td><span class="information">: <?php echo "".$commande["prixavance"];?> </span></td>
</tr>
<tr>
<td>N° Versement </td>
<td colspan="2"><span class="information">: Information </span></td>
<td> </td>
</tr>
</table>
<div id="bank-inf"><fieldset><legend>Informations pour le versement bancaire</legend>
<table width="100%" class="content">
<tr>
<td width="120">Bénéficiaire</td>
<td colspan="3"><span class="information">: Futurex </span></td>
</tr>
<tr>
<td>Banque 1 </td>
<td><span class="information">: ECOBANK </span></td>
<td width="100">Compte</td>
<td><span class="information">: 2001011219849 </span></td>
</tr>
<tr>
<td>Banque 2 </td>
<td><span class="information">: EXPRESS UNION NIKI MC </span></td>
<td>Compte</td>
<td><span class="information">: 37180011040001830 </span></td>
</tr>
</table>
</fieldset></div>
<span class="printbutton"><a href="#" onclick="javascript:window.print(); return false;" title="Version imprimable"><img src="images/printButton.png" width="16" height="16" border="0" align="left" /> Imprimer </a></span></div>
</body>
</html>
<?php
include("phpToPDF.php");
$PDF=new phpToPDF();
$PDF->AddPage();
$PDF->SetFont("Arial","B",16);
$PDF->Output();
?> |
merci