Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks > PDF > FPDF
FPDF Forum d'entraide pour la bibliothèque FPDF permettant de générer des documents PDF en PHP. Avant de poster -> tutoriels FPDF
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 27/11/2006, 10h53   #1
Membre du Club
 
Inscription : avril 2005
Messages : 318
Détails du profil
Informations forums :
Inscription : avril 2005
Messages : 318
Points : 61
Points : 61
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 :
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 :
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
arsenik7 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/11/2006, 11h45   #2
Membre du Club
 
Inscription : avril 2005
Messages : 318
Détails du profil
Informations forums :
Inscription : avril 2005
Messages : 318
Points : 61
Points : 61
la solution :
Code :
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
arsenik7 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/11/2006, 17h17   #3
Membre du Club
 
Inscription : avril 2005
Messages : 318
Détails du profil
Informations forums :
Inscription : avril 2005
Messages : 318
Points : 61
Points : 61
qui a deja manipulier un css dans la creation d'un pdf avec html2fpdf ?
arsenik7 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/12/2006, 09h18   #4
Rédacteur
 
Avatar de Yogui
 
Homme Guillaume Rossolini
Directeur technique
Inscription : février 2004
Messages : 13 720
Détails du profil
Informations personnelles :
Nom : Homme Guillaume Rossolini
Localisation : France

Informations professionnelles :
Activité : Directeur technique

Informations forums :
Inscription : février 2004
Messages : 13 720
Points : 17 355
Points : 17 355
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
__________________
Mes articles - Zend Certified Engineer (PHP + Zend Framework)
Ressources PHP - Ressources Zend Framework
Yogui est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 29/12/2007, 23h24   #5
Membre du Club
 
Inscription : mai 2007
Messages : 209
Détails du profil
Informations forums :
Inscription : mai 2007
Messages : 209
Points : 50
Points : 50
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
christobale est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 15h35.


 
 
 
 
Partenaires

Hébergement Web