1

Hi there,

I used this greatfull programm without problems. happy But now, I will used an own font. And now I have problems to take a new font in a pdf dokument. In fact, the script shows a blank pdf dokument. But I can´t find an error. Here my steps:


1. TTF Font load from http://www.fontsaddict.com/font/eminenz.html and copy it in my "fonts" folder

2. With http://www.fpdf.org/makefont/ I have convert this TTF Font to "eminez.php" (CP1252). The error messages I have ignored.

3. I have copied "eminenz.php" in my "fonts" folder, too

what´s wrong ?

here my script. Hope, you can help me smile
<style> @font-face { font-family: "eminenz"; src: url("../fonts/eminenz.ttf") format("truetype"); } </style> <?php $text='<div style="position:relative; width:800px; border-style:solid; border-width:1px; border-color:#C0C0C0; font-family:eminenz; font-size:30px; text-align: left; color: #4642EF;">This is a test ....</div>'; // Durch weglassen von "font-family:eminenz;" korrekte Erstellung echo $text; require_once(dirname(__FILE__).'/../html2pdf/html2pdf.class.php'); try { $oben=5; //mT $unten=0; //mB $links=0; //mL $rechts=0; //mR $html2pdf = new HTML2PDF('P','A4','de', false, 'UTF-8', array($links, $oben, $rechts, $unten)); $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->addFont('eminenz', '', '../fonts/eminenz.php'); $html2pdf->writeHTML($text, isset($_GET['vuehtml'])); $html2pdf->Output('test.pdf', 'F'); } catch(HTML2PDF_exception $export) { echo $export; exit; } ?>

2

Hi, (I'm French so sorry for my quite basic english)

I believe that you don't have to declare css to use a font, next to your addfont() declaration, you've to declare your Defaultfont like here:

$html2pdf->setDefaultFont('eminenz');

3

Hi alexdu17200,

thank you for your message. Your english is very good :-)

I have put your code in my script. But it dosn´t work. I have ever a white screen without text. Have you perhaps another idea?

<style> @font-face { font-family: "eminenz"; src: url("../fonts/eminenz.ttf") format("truetype"); } </style> <?php $text='<div style="position:relative; width:800px; border-style:solid; border-width:1px; border-color:#C0C0C0; font-family:eminenz; font-size:30px; text-align: left; color: #4642EF;">This is a test ....</div>'; // Durch weglassen von "font-family:eminenz;" korrekte Erstellung echo $text; require_once(dirname(__FILE__).'/../html2pdf/html2pdf.class.php'); try { $oben=5; //mT $unten=0; //mB $links=0; //mL $rechts=0; //mR $html2pdf = new HTML2PDF('P','A4','de', false, 'UTF-8', array($links, $oben, $rechts, $unten)); $html2pdf->setModeDebug(); $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->addFont('eminenz', '', '../fonts/eminenz.php'); $html2pdf->setDefaultFont('eminenz'); $html2pdf->writeHTML($text, isset($_GET['vuehtml'])); $html2pdf->Output('test.pdf', 'F'); } catch(HTML2PDF_exception $export) { echo $export; exit; } ?>

4

I am far from an expert Html2pdf ^ ^ I know a small part of his duties.
Currently, in my pdf export file, I only these lines:
require_once(dirname(__FILE__).'/html2pdf/html2pdf.class.php'); $html2pdf = new HTML2PDF('P', 'A4', 'fr', false, 'ISO-8859-1', array(6, 6, 6, 0)); //array refer to the margins $html2pdf->addFont('MyFont', '', dirname(__FILE__).'/html2pdf/_tcpdf_5.0.002/fonts/MyFont.php'); $html2pdf->setDefaultFont('MyFont'); $html2pdf->WriteHTML($content); $html2pdf->Output($output_file, 'F');

That "work", well, I've still a problem, but it comes from my file police. Php.

5

Hi there,

I have found the solution. It was a stupid mistake.

As I have converting the TTF font, I don´t have copied the file "eminenz.z" in the fonts folder. With this file, the output is functioning properly.

boing boing boing

6

Indeed, that's a stupid mistake^^ The important thing is that it's resolved