IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Bibliothèques et frameworks PHP Discussion :

[phpToPDF] Le html avec phptopdf


Sujet :

Bibliothèques et frameworks PHP

  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Août 2008
    Messages
    52
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2008
    Messages : 52
    Par défaut [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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 &agrave; 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&eacute; | T&eacute;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">&nbsp;</td>
      </tr>
      <tr>
        <td>Client</td>
        <td colspan="3"><span class="information">: <?php echo "".$client["nomcl"]." ".$client["prenomcl"];?> </span></td>
        </tr>
      <tr>
        <td>T&eacute;l&eacute;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&eacute;cision</td>
        <td colspan="2" valign="top"><span class="information">: <?php echo "".$commande["detail"];?> </span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>URL</td>
        <td colspan="3"><span class="information">: <?php echo "".$commande["url"];?> </span></td>
        </tr>
      <tr>
        <td>Montant &agrave; 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&deg; Versement </td>
        <td colspan="2"><span class="information">: Information </span></td>
        <td>&nbsp;</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&eacute;n&eacute;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

  2. #2
    Membre émérite
    Avatar de jc_cornic
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    623
    Détails du profil
    Informations personnelles :
    Âge : 50
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 623
    Par défaut
    Salut,
    Tu veux donc générer en pdf une page html dynamique (dépendante d'une BDD), c ca?

    Si oui, il ne faut envoyer au navigateur que le output de phptopdf, pas de html avant.

    Ensuite, si tu dois écrire en php la structure de ta page mais au lieu de faire des echos de tes items graphiques, tu dois remplir ton objet phpToPDF.

    Essayes un peu de code avec les exemples mis sur la page phpToPDF et si tu galères trop, envois ton code...

    Par contre, avec cette lib, tu ne pas ajouter de boutons style radio ou autres, tu peux mettre du texte, des images, des graphiques simples et des tableaux.

    A+
    JC

Discussions similaires

  1. Page blanche avec phpToPDF et PostgreSQL
    Par devel77 dans le forum PHP & Base de données
    Réponses: 16
    Dernier message: 09/11/2011, 15h26
  2. Réponses: 6
    Dernier message: 27/08/2010, 09h28
  3. [VB6] recuperer des valeurs ds un tableau html avec vb!!
    Par leo13 dans le forum VB 6 et antérieur
    Réponses: 3
    Dernier message: 11/12/2004, 13h02
  4. [DOM] Comment lire de l'HTML avec DOM ?
    Par djodjo dans le forum Format d'échange (XML, JSON...)
    Réponses: 2
    Dernier message: 20/04/2004, 15h37
  5. impression HTML avec la librairie wxwindows
    Par farscape dans le forum Autres éditeurs
    Réponses: 1
    Dernier message: 23/12/2003, 08h47

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo