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] Bug génération pdf avec html2pdf


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] Bug génération pdf avec html2pdf
    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]
    Tags are closed in a wrong order for [page]
    File: C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\Facturation\vendor\spipu\html2pdf\src\Parsing\Html.php
    Line: 233
    Invalid Tag: page
    Html Line: 44
    Voici mes 2 fichier de génération :

    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
    <?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';
     
     
    use Spipu\Html2Pdf\Html2Pdf;
    use Spipu\Html2Pdf\Exception\Html2PdfException;
    use Spipu\Html2Pdf\Exception\ExceptionFormatter;
     
     
    try {
        ob_start();
        include dirname(__FILE__).'/res/test.php';
        $content = ob_get_clean();
     
     
        $html2pdf = new Html2Pdf('P', 'A4', 'fr', 'UTF-8');
        $html2pdf->pdf->SetDisplayMode('fullpage');
        $html2pdf->writeHTML($content);
        $html2pdf->output('test.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
    <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">
      <table class="header">
        <tr>
          <td class="text-left">
            <b>Prénom Nom</b>
            <br>Adresse
            <br>Code postal
            <br>Pays
          </td>
          <td class="text-right">
            <b>Prénom Nom</b>
            <br>Adresse
            <br>Code postal
            <br>Pays
          </td>
        </tr>
      </table>
      <div class="separator"></div>
      <table> 
      <tr>
      <td>N° de facture: </td>
      <td>Date:</td>
      </tr>
    <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>
      <tr class="couleurgris">
          <td class="text-left">PRESTATION 1</td>
          <td class="text-center">NOMBRE DE JOURS 1</td>
          <td class="text-center">TARIF JOURNALIER 1</td>
          <td class="text-right">TOTAL HT 1</td>
      </tr>
     </tbody>
      </table>
    </page>
    Je crois que le problème vient du html/css mais je ne vois pas où.
    Aidez-moi svp, merci

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    ton <table> ligne 30 n'est pas fermé.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  3. #3
    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
    Exact comment je n'ai pas vu ça ! Merci

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [PDF] Generer pdf avec HTML2PDF
    Par luthor_06 dans le forum Bibliothèques et frameworks
    Réponses: 6
    Dernier message: 14/11/2017, 09h30
  2. problème génération PDF avec HTML2PDF
    Par int59 dans le forum Bibliothèques et frameworks
    Réponses: 0
    Dernier message: 12/06/2015, 11h38
  3. [PDF] création d'un fichier pdf avec HTML2PDF
    Par lowvensky dans le forum Bibliothèques et frameworks
    Réponses: 15
    Dernier message: 17/07/2013, 16h22
  4. [PDF] generer pdf avec html2pdf
    Par le beauceron dans le forum Bibliothèques et frameworks
    Réponses: 4
    Dernier message: 14/08/2012, 12h43

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