Salut à tous,
Alors voilà je tente désespérément de générer un pdf, mais rien n'a faire je n'y arrive pas!
Voilà j'ai un fichier index.php :
<p>
Générer :
</p>
// récupération du contenu HTML
ob_start();
include(dirname(__FILE__).'/mag.php');
$content = ob_get_clean();
// conversion HTML => PDF
require_once(dirname(__FILE__).'/html2pdf.class.php');
$html2pdf = new HTML2PDF('P','A4','fr');
// $html2pdf->setModeDebug();
$html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
$html2pdf->Output('magazine.pdf');
echo "PDF file is generated successfully!";
<p>
<a href="index.php"> Index </a>
</p>
Et un fichier mag.php :
<?xml version="1.0" encoding="iso-8859-1"?>
<!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>
<title>MonMagazine!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<center><h3>AndroidMag</h3></center>
<p> Salut à tous </p>
<?php
echo "Sa va?";
?>
</body>
</html>
Mon but, transformer mag.php en magazine.pdf.
Mais il y a des bugs :
Générer :
Notice: Undefined offset: 1 in C:\wamp\www\pdf\parsingHTML.class.php on line 236
Notice: Undefined offset: 2 in C:\wamp\www\pdf\parsingHTML.class.php on line 239
Notice: Undefined offset: 1 in C:\wamp\www\pdf\parsingHTML.class.php on line 236
Notice: Undefined offset: 2 in C:\wamp\www\pdf\parsingHTML.class.php on line 239
ERREUR n°5
Fichier : C:\wamp\www\pdf\parsingHTML.class.php
Ligne : 176
Code HTML non valide, toutes les balises doivent être fermées.
Etat :
Array
(
[0] =>
[1] =>
)
Merci