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 :

[PDF] Html2Pdf Error [1]


Sujet :

Bibliothèques et frameworks PHP

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Femme Profil pro
    Développeur Web
    Inscrit en
    Octobre 2010
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Seine Maritime (Haute Normandie)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Octobre 2010
    Messages : 414
    Par défaut [PDF] Html2Pdf Error [1]
    Bonjour


    Je suis en train de vouloir générer une facture en PDF mais je ne comprends pas d'où vient le bug, ça ne marche pas. J'ai ce message d'erreur qui ne me renseigne sur rien:
    Html2Pdf Error [1]
    Too many tag closures found for [page]
    File: C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\Facturation_generale\vendor\spipu\html2pdf\src\Parsing\Html.php
    Line: 228
    Invalid Tag: page
    Html Line: 48
    Voici mon code HTML/PHP:
    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
    <style type="text/css">
    table{width: 100%; border-collapse:collapse; font-size:18px}
    .header td{width: 50%; vertical-align: top, background-color: #57B223}
    .text-left{text-align: left}
    .text-right{text-align: right}
    .text-center{text-align: center}
    .separator{height: 150px; width: 100%}
    .content td{border:solid 1px #CFD1D2; padding: 5px;}
    .content th{border:solid 1px #000000; padding: 5px; background-color: #000000; color: #FFFFFF}
    .ligne1Content{background-color:#57B223}
    .couleurgris{background-color:#DDDDDD; height:200px}
    </style>
    <page backtop="20mm" backright="10mm" backbottom="20mm" backleft="10mm">
      <?php
      require_once 'connexion.php';
     
     
      $resFC1=$base->prepare("SELECT * FROM infosfacture WHERE num= ?");
      $resFC1->bindValue(1, $id, PDO::PARAM_INT);
      $resFC1->execute(array($_GET['num']));
     
     
      $resFC = $base->prepare('SELECT infosfacture.num, infosfacture.client, infosfacture.datefacture, infosfacture.facturede, infosfacture.conditions, facturation.designation, facturation.quantite, facturation.prixht
      FROM infosfacture
      INNER JOIN facturation
      ON infosfacture.num=? AND facturation.fk_facturation_id=infosfacture.id');
      $resFC->execute(array($_GET['num']));
      ?>
      <?php foreach ($resFC1 as $req): ?>
      <table class="header">
        <tr>
          <td class="text-left">
            <b>Facturé à : <?php echo $req['client'] ?></b>
            <br>
          </td>
          <td class="text-right">
            <b>Facture de : <?php echo $req['$facturede'] ?></b>
            <br>
          </td>
        </tr>
      </table>
      <div class="separator"></div>
    <table>
      <tr>
      <td class="text-left">N° de facture: <?php echo $req['num'] ?>  </td>
      <td class="text-right">Date: <?php echo $req['datefacture'] ?></td>
      </tr>
     </table>
     <?php endforeach; ?>
    <br/><br/>
      <table class="content">
        <thead>
        <tr class="ligne1Content">
          <td class="text-left">PRESTATION</td>
          <td class="text-center">NOMBRE DE JOURS</td>
          <td class="text-center">TARIF JOURNALIER</td>
          <td class="text-right">TOTAL HT</td>
        </tr>
      </thead>
      <tbody>
        <?php foreach ($resFC as $req): ?>
      <tr class="couleurgris">
          <td class="text-left"><?php echo $req['designation'] ?></td>
          <td class="text-center"><?php echo $req['$quantite'] ?></td>
          <td class="text-center"><?php echo $req['$prixht'] ?></td>
          <td class="text-right"><?php echo $req['quantite'] * $req['prixht'] ?></td>
      </tr>
      <?php endforeach; ?>
     </tbody>
     <tfoot>
     </tfoot>
      </table>
    </page>
    Je crois que le problème vient du html/css mais je ne vois pas où.
    Aidez-moi svp, merci

  2. #2
    Membre éclairé
    Femme Profil pro
    Développeur Web
    Inscrit en
    Octobre 2010
    Messages
    414
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Seine Maritime (Haute Normandie)

    Informations professionnelles :
    Activité : Développeur Web

    Informations forums :
    Inscription : Octobre 2010
    Messages : 414
    Par défaut
    J'ai modifier le code et maintenant j'arrive à générer un pdf mais ce dernier est vide (page blanche). Aidez-moi svp !

    Voici mes codes :
    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
    <?php/**
     * Html2Pdf Library - example
     *
     * HTML => PDF converter
     * distributed under the OSL-3.0 License
     *
     * @package   Html2pdf
     * @author    Laurent MINGUET <webmaster@html2pdf.fr>
     * @copyright 2017 Laurent MINGUET
     */
    require_once dirname(__FILE__).'/vendor/autoload.php';
    require('html2pdf/html2pdf.class.php');
    require_once dirname(__FILE__).'/vendor/autoload.php';
    require_once(dirname(__FILE__).'/vendor/spipu/html2pdf/html2pdf.class.php');
    use Spipu\Html2Pdf\Html2Pdf;
    use Spipu\Html2Pdf\Exception\Html2PdfException;
    use Spipu\Html2Pdf\Exception\ExceptionFormatter;
     
     
    try {
        ob_start();
        include (dirname(__FILE__).'imprimerhtml.php');
        $content = ob_get_clean();
     
     
        $html2pdf = new Html2Pdf('P', 'A4', 'fr');
        $html2pdf->pdf->SetDisplayMode('fullpage');
        $html2pdf->writeHTML($content);
        $html2pdf->output('facture.pdf');
    } catch (Html2PdfException $e) {
        $html2pdf->clean();
     
     
        $formatter = new ExceptionFormatter($e);
        echo $formatter->getHtmlMessage();
    }
    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
    <style type="text/css">table{width: 100%; border-collapse:collapse; font-size:18px}
    .header td{width: 50%; vertical-align: top}
    .text-left{text-align: left}
    .text-right{text-align: right}
    .text-center{text-align: center}
    .separator{height: 50px; width: 100%}
    .content td{border:solid 1px #CFD1D2; padding: 5px;}
    .content th{border:solid 1px #000000; padding: 5px; background-color: #000000; color: #FFFFFF}
    .ligne1Content{background-color:#57B223}
    .couleurgris{background-color:#DDDDDD; height:auto;}
    .tht, .taxe, .ttc{font-size: 1.2em;}
    .ttc{color:#57B223}
    .couleurverte{background-color: #57B223}
    .couleurmoinsgris{background: #EEEEEE;}
    </style>
    <page backtop="20mm" backright="10mm" backbottom="20mm" backleft="10mm">
      <?php
      require_once 'connexion.php';
     
     
      $resFC1=$base->prepare("SELECT * FROM infosfacture WHERE num= ?");
      $resFC1->bindValue(1, $id, PDO::PARAM_INT);
      $resFC1->execute(array($_GET['num']));
     
     
      $resFC = $base->prepare('SELECT infosfacture.num, infosfacture.client, infosfacture.datefacture, infosfacture.facturede, infosfacture.conditions, facturation.designation, facturation.quantite, facturation.prixht
      FROM infosfacture
      INNER JOIN facturation
      ON infosfacture.num=? AND facturation.fk_facturation_id=infosfacture.id');
      $resFC->execute(array($_GET['num']));
      ?>
      <?php foreach ($resFC1 as $req): ?>
      <table class="header">
        <tr>
          <td class="text-left">
            Facturé à :<br/> <b><?php echo $req['client'] ?></b>
            <br>
          </td>
          <td class="text-right">
            Facture de :<br/><b> <?php echo $req['facturede'] ?></b>
            <br>
          </td>
        </tr>
      </table>
      <div class="separator"></div>
    <table>
      <tr>
      <td class="text-left">N° de facture: <b><?php echo $req['num'] ?></b>  </td>
      <td class="text-right">Date: <b><?php echo $req['datefacture'] ?></b></td>
      </tr>
     </table>
     <?php $tva = $req['tva'] ?>
     <?php $conditions = $req['conditions'] ?>
     <?php endforeach; ?>
    <br/><br/>
      <table class="content">
        <thead>
        <tr class="ligne1Content">
          <td class="text-left couleurgris"><b>DESIGNATION</b></td>
          <td class="text-center couleurmoinsgris"><b>QUANTITE</b></td>
          <td class="text-center couleurgris"><b>PRIX HT</b></td>
          <td class="text-right couleurverte"><b>TOTAL HT</b></td>
        </tr>
      </thead>
      <tbody>
        <?php $somme = 0;?>
        <?php foreach ($resFC as $req): ?>
      <tr class="couleurgris">
          <td class="text-left couleurgris"><?= $req['designation'] ?></td>
          <td class="text-center couleurmoinsgris"><?= $req['quantite'] ?></td>
          <td class="text-center"><?= $req['prixht'] ?></td>
          <td class="text-right couleurverte"><?= $req['quantite'] * $req['prixht'] ?></td>
      </tr>
      <?php $somme += $req['prixht'] * $req['quantite']; ?>
      <?php endforeach; ?>
     </tbody>
     <tfoot>
       <tr>
         <td colspan="3" class="text-right tht">TOTAL HT</td>
         <td class="tht"><?= $somme; ?></td>
       </tr>
       <tr>
         <td colspan="3" class="text-right taxe">TAXE à <?php echo $tva; ?>% </td>
         <td class="taxe"><?= $somme * $tva/100; ?></td>
       </tr>
       <tr>
         <td colspan="3" class="text-right ttc">TOTAL TTC</td>
         <td class="ttc"><?= $somme + $somme*$tva/100; ?></td>
       </tr>
     
     
       <tr>
         <td colspan="4"><h3>Conditions et moyens de paiement:</h3><br/><?= $conditions ?></td>
       </tr>
     
     
     </tfoot>
      </table>
    </page>

Discussions similaires

  1. [PDF] Html2pdf - Certains pdf OK d'autres non (même script)
    Par kaching dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 02/04/2013, 14h37
  2. [PDF] html2pdf erreur " Impossible de charger l'image "
    Par ranell dans le forum Bibliothèques et frameworks
    Réponses: 2
    Dernier message: 04/11/2011, 11h19
  3. [PDF] HTML2PDF ver3.08 balise img
    Par miabi dans le forum Bibliothèques et frameworks
    Réponses: 0
    Dernier message: 13/07/2011, 14h11
  4. [PDF] html2PDF Erreur n°3
    Par PrinceMaster77 dans le forum Bibliothèques et frameworks
    Réponses: 0
    Dernier message: 14/02/2010, 23h02
  5. [PDF] HTML2pdf et table
    Par KiranoO dans le forum Bibliothèques et frameworks
    Réponses: 2
    Dernier message: 20/06/2008, 10h46

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