I have to generate pdf documents and I use html2pdf 4.4.0, I need ton add a custom font but I couldn't make it work despite trying every solutions I found on Google..
My code (based on a basic exemple from html2pdf) :
require_once(dirname(__FILE__).'/../html2pdf.class.php'); try { $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->addFont('avenir-roman', '', dirname(__FILE__).'/Avenir/avenir-roman-webfont.php'); $html2pdf->writeHTML($content, isset($_GET['vuehtml'])); $html2pdf->Output('print.pdf'); } catch(HTML2PDF_exception $e) { echo $e; exit; }
Return : TCPDF ERROR: Could not include font definition file: 'avenir-roman'
I generated avenir-roman-webfont.php and avenir-roman-webfont.z with http://www.fpdf.org/makefont/make.php from a ttf file I use and even chmod 755 them just in case
Every help would be greatly appreciated
Thanks
EDIT : finally found it myself, error came from css line ->
font-family:avenir-roman; /* works */
font-family:'avenir-roman'; /* error */
Hope it could help someone...