1

Hi,

I have problem with using my own font.
I've generated files like in the tutorial FPDF doc:
http://www.fpdf.org/en/tutorial/tuto7.htm

This is my code:
<?
define('FPDF_FONTPATH','../libs/fpdf/font/');
require_once('../libs/html2pdf.class.php');
$html2pdf = new HTML2PDF('L','A4', 'en', array(5, 5, 5, 5));
$html2pdf->AddFont('arialpl','','arialpl.php');
$html2pdf->SetFont('arialpl','', 8);
$html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
$html2pdf->Output('exemple02.pdf');
?>
And it still looks like using Helvetica instead of Arial with Polish charts.

2

if you try with this HTML code, you have the same result on the 2 lines ?

<span style="font-family: arialpl">Test de fonte</span><br>
<span>Test de fonte</span><br>
Ancien pseudo : lolo

3

Hi,

I have the same problem and tried your HTML code. The first line is ok but not the second...

4

... you have to write the font-family if you want to use it smile

on the html exemple, the first line will use your font, and the second will use the default font !
Ancien pseudo : lolo

5

so i'll do that !
thanks

6

Bonjour,

j'ai un problème avec l'utilisation des polices supplémentaires.

Voici mon code :

$content = ob_get_clean();
define('FPDF_FONTPATH','/../fpdf/_fpdf/font/');
require_once(dirname(__FILE__).'/../fpdf/html2pdf.class.php');
$html2pdf->AddFont('Times','','Times.php');
$html2pdf = new HTML2PDF('L','A4', 'fr');
$html2pdf->WriteHTML($content);
$html2pdf->Output('Demande d\' achat.pdf');

Lorsque j'essaie de générer mon pdf, j'obtiens l'erreur suivante:

Notice: Undefined variable: html2pdf in C:\Formulaires\Achats.php on line 195
Fatal error: Call to a member function AddFont() on a non-object in C:\Formulaires\Achats.php on line 195

la ligne 195 étant : $html2pdf->AddFont('Times','','Times.php');

De plus si je mets cette ligne en commentaire, j'obtiens l'erreur suivante :

Warning: include(/../fpdf/_fpdf/font/helvetica.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\Intranet_Arpege\fpdf\_fpdf\fpdf.php on line 541
Warning: include() [function.include]: Failed opening '/../fpdf/_fpdf/font/helvetica.php' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\Intranet_Arpege\fpdf\_fpdf\fpdf.php on line 541
FPDF error: Could not include font metric file

7

le define de fpdf_fontpath n'est pas utile si tu as mis ta fonte dans le meme repertoire que les fontes d'origine.

de plus, il faut que tu mette le AddFont une fois que tu as créé ton objet html2pdf (new), pas avant, sinon il n'existe pas !
Ancien pseudo : lolo