I have the following code:
<?php session_start();
ob_start();
// on vérifie toujours qu'il s'agit d'un membre qui est connecté
if (!isset($_SESSION['login'])) {
// si ce n'est pas le cas, on le redirige vers l'accueil
header ('Location: ../index.php');
exit();
}
require_once('Connections/localhost.php');
mysql_select_db( $database_localhost ); ?>
<page backtop="50mm" backbottom="30mm" >
<page_header> <font face="arial">
<?php $sql="SELECT `entete`, `pieddepage` FROM `entete` INNER JOIN `courrier` ON `entete`.`id` = `courrier`.`code_entete` WHERE `courrier`.`code_lettre`='".mysql_real_escape_string($_POST['courrier'])."'" ;
$msg= $_POST['msg'];
$result= mysql_query($sql);
$donnees=mysql_fetch_assoc($result) ;
echo $donnees['entete'] ; ?> </font>
</page_header>
<page_footer> <font face="arial">
<?php echo $donnees['pieddepage'] ; ?>
</font>
</page_footer>
<font face="arial">
<?php echo '<font face="Arial">'.$_POST['editor1'].'</font>' ; ?></font>
</page>
<?php $content=ob_get_contents();
ob_end_clean();
require_once('html2pdf.class.php');
$html2pdf = new HTML2PDF('P','A4','fr');
$html2pdf->WriteHTML($content);
$path= 'courriers';
if(file_exists($path))
{
mkdir($path.'/'.$_GET['n_doss']);
}
else
{
mkdir($path);
mkdir($path.'/'.$_GET['n_doss']);
}
$html2pdf->Output($path.'/'.$_GET['n_doss'].'/'.$_POST['nom_courrier'].'-'.date('d-m-Y').'.pdf', 'F');
$url=$path.'/'.$_GET['n_doss'].'/'.$_POST['nom_courrier'].'-'.date('d-m-Y').'.pdf';
$sql="INSERT INTO `courrier-envoye` SET
qui = '".$_SESSION['login']."',
quoi = '".$_POST['nom_courrier']."',
quand = '".date('Y-m-d')."',
n_doss= '".$_GET['n_doss']."',
url= '".$url."'";
$req=mysql_query($sql) or die(__LINE__.mysql_error().$sql);
header('Location: '.$url);
?>
In fact it says to me:
TCPDF ERROR: Could not include font definition file: verdana
But the thing is that I never put somewhere in my code something like <font face='verdana'>
So I really do not know where does this trouble come from.
Receive all my Utmost Respect.
Kind Regards.
SP
Look at this one. may be it helps.
1.convert any verdana.ttf font file to cp-1252 encoding in http://www.fpdf.org/makefont/
2.drop the encoded file into the fonts directory in html2pdf or tcpdf or fpdf code for pdf convertion
$html2pdf = new HTML2PDF('P', 'A4', 'fr');
$root_directory="/your root directory to pdf convertion package like tcpdf,html2pdf,fpdf/";
$html2pdf->addFont('verdana', '', ''.$root_directory.'/fonts/source-sans-pro.light.php');
//use your font-family:verdana into the html tag in $content
$content="<b style='font-family:verdana'>hello</b>";
$html2pdf->writeHTML($content);
$html2pdf->Output();
check your pdf file