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 :

[FPDF] Utiliser html2fpdf problème


Sujet :

Bibliothèques et frameworks PHP

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    318
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2005
    Messages : 318
    Points : 99
    Points
    99
    Par défaut [FPDF] Utiliser html2fpdf problème
    Bonjour , voici mon erreur :

    Warning: Cannot modify header information - headers already sent by (output started at /home/jlevasseur/workspace/fmo/web/html2fpdf/fpdf.php:1095) in /home/jlevasseur/workspace/fmo/web/html2fpdf/fpdf.php on line 1664
    FPDF error: Some data has already been output to browser, can't send PDF file

    J'obtiens pourant bien le buffer qu'il me faut , voila le code :
    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
    //Get file contents
    		ob_start();
    		   readfile($htmlFile);
    		   echo 'test';
    		   $buffer = ob_get_contents();
    		 ob_end_clean();
     
    		fclose($file);
     
     
     
    		$pdf=new HTML2FPDF();
    		$pdf->AddPage();
    		$pdf->WriteHTML($buffer);
    		$pdf->Output();
    et voici le html à transformer :
    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
    <!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>Liste des machines</title>
    <style type="text/css">
    <!--
    body {
    	font-family: Arial, Helvetica, sans-serif;
    }
    .tableau {
    	border-top: 1pt solid #333333;
    	border-left: 1pt solid #333333;
    	border-right: 1pt solid #333333;
    	border-bottom: 1pt solid #333333;
    }
     
    .tableau td {
    	border-bottom: 0pt solid #333333;
    	padding: 1px 2px 1px 4px;
    	font-size: 9pt;
    }
    .tableau td p {
    	margin: 1px 2px 1px 4px;
    }
    h1.genre {
    	font-size: 12pt;
    }
     
    td.titre {
    	font-size: 9pt;
    	font-weight:bold;
    	border-bottom: 1pt solid #333333;
    }
    table.entete {
    	font-size: 9pt;
    }
     
    table.footer {
    	font-size: 9pt;
    }
    -->
    </style>
    </head>
    <body>
    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="entete">
      <tr>
        <td width="50%"></td>
     
        <td align="right">Liste des machines </td>
      </tr>
    </table>
    </body><body><h1 class="genre"><?php echo $titre; ?></h1>
    				<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableau">
    		   	<tr>
    		    <td bgcolor="#CCCCCC" class="titre">Marque</td>
    		    <td bgcolor="#CCCCCC" class="titre">Type</td>
     
    		    <td bgcolor="#CCCCCC" class="titre">N&deg; Stock </td>
    		    <td bgcolor="#CCCCCC" class="titre">Lieu</td>
    		    <td bgcolor="#CCCCCC" class="titre">Soci&eacute;t&eacute;</td>
    		    <td bgcolor="#CCCCCC" class="titre"><div align="right">Prix</div></td>
    		    <td bgcolor="#CCCCCC" class="titre">Status</td>
    		  	</tr>
    		  	<tr>
    		<tr bgcolor='#99CCFF'><td>ALPA</td><td>PSO124 UNK</td><td>3</td><td>Bruay-sur-Escaut</td><td>Accessoires</td><td>21842</td><td>Option vente/R?serv</td></tr><tr bgcolor='#99CCFF'><td colspan='7'>Diam<strong></strong>Module<strong></strong>Longueur maximale <strong></strong>Poids approximatif<strong></strong><br>Encombrement <strong>400x1000x1000</strong></td></tr><tr><td>ALBA</td><td>RO TB12</td><td>1</td><td>Bruay-sur-Escaut</td><td>National Machines Outils</td><td>12150</td><td>En pr?paration</td></tr><tr><td colspan='7'>Diam<strong>400x200x300</strong>Module<strong>100x200</strong>Longueur maximale <strong>1500</strong>Poids approximatif<strong>400</strong><br>Encombrement <strong>1200x200x400</strong></td></tr></table><body><h1 class="genre"><?php echo $titre; ?></h1>
    				<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableau">
    		   	<tr>
    		    <td bgcolor="#CCCCCC" class="titre">Marque</td>
    		    <td bgcolor="#CCCCCC" class="titre">Type</td>
     
    		    <td bgcolor="#CCCCCC" class="titre">N&deg; Stock </td>
    		    <td bgcolor="#CCCCCC" class="titre">Lieu</td>
    		    <td bgcolor="#CCCCCC" class="titre">Soci&eacute;t&eacute;</td>
    		    <td bgcolor="#CCCCCC" class="titre"><div align="right">Prix</div></td>
    		    <td bgcolor="#CCCCCC" class="titre">Status</td>
    		  	</tr>
    		  	<tr>
    		<tr bgcolor='#99CCFF'><td>ADAM</td><td>YO 12B</td><td>2</td><td>Vaulx En Velin</td><td>National Machines Outils</td><td>15780</td><td>En commande occasion</td></tr><tr bgcolor='#99CCFF'><td colspan='7'>Diam<strong>-</strong>Module<strong>-</strong>Longueur maximale <strong>-</strong>Poids approximatif<strong>-</strong><br>Encombrement <strong>800x100x430</strong></td></tr><tr><td>AMADA</td><td>HYKIO01215</td><td>4</td><td>Bagneux</td><td>France Machines Outils</td><td>74000</td><td>Vendue</td></tr><tr><td colspan='7'>Diam<strong>-</strong>Module<strong>100x100x100</strong>Longueur maximale <strong>-</strong>Poids approximatif<strong>-</strong><br>Encombrement <strong>420x120x100</strong></td></tr></table></body></html>
    Merci

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    318
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2005
    Messages : 318
    Points : 99
    Points
    99
    Par défaut
    la solution :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    $pdf=new HTML2FPDF();
    		$pdf->AddPage();	
    		//Get file contents
    		ob_start();
    		   readfile($htmlFile);		   
    		   $this->buffer = ob_get_contents();
    		   $pdf->WriteHTML($this->buffer);
    		 ob_end_clean();
    		fclose($file);
    		$pdf->Output();
    Mais je n'arrive pas a prendre en compte ma feuille de style du fichier html

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    318
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2005
    Messages : 318
    Points : 99
    Points
    99
    Par défaut
    qui a deja manipulier un css dans la creation d'un pdf avec html2fpdf ?

  4. #4
    Rédacteur

    Avatar de Yogui
    Homme Profil pro
    Directeur technique
    Inscrit en
    Février 2004
    Messages
    13 721
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Yonne (Bourgogne)

    Informations professionnelles :
    Activité : Directeur technique

    Informations forums :
    Inscription : Février 2004
    Messages : 13 721
    Points : 29 985
    Points
    29 985
    Par défaut
    Salut

    Pour ton problème initial, la réponse se trouve ici quel que soit ce que tu utilises (FPDF ou autre) :
    http://php.developpez.com/faq/?page=...s_already_sent

  5. #5
    Invité
    Invité(e)
    Par défaut
    bonjour,
    je sais que ce post date d'un 1 an mais as tu trouver la solution a ton pb.
    je suis dans le même cas, je n'arrive pas a faire prendre en compte ma feuille de style avec html2pdf.

    merci de ta réponse et bonne année

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

Discussions similaires

  1. [FPDF] Utilisation de fpdf
    Par nicoaix dans le forum Bibliothèques et frameworks
    Réponses: 5
    Dernier message: 12/10/2009, 16h54
  2. [FPDF] Utiliser les images Gif
    Par ygrim dans le forum Bibliothèques et frameworks
    Réponses: 3
    Dernier message: 19/07/2007, 16h45
  3. Jeu SDL utilisant Winsock2, problème réseau
    Par TONIAPEL dans le forum C
    Réponses: 2
    Dernier message: 22/08/2006, 21h15
  4. [FPDF] Utilisation des librairies ezpdf et fpdf
    Par kirsoul dans le forum Bibliothèques et frameworks
    Réponses: 10
    Dernier message: 10/01/2006, 13h07
  5. Utiliser CFile... Problème de bibliothèques
    Par GregouzeLaLoose dans le forum MFC
    Réponses: 8
    Dernier message: 01/07/2005, 15h08

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