Question:
I am using the framework cake PHP 3 and I am generating a pdf using the DOMPDF liberia the problem that the pdf uses a font that I don't know how to apply it,
It is worth mentioning that the pdf is created with html from a controller:
**
$html = "<!DOCTYPE HTML>
<html lang='en'>
<head>
<meta charset='utf-8'>
<style>
@font-face {
font-family: 'Soberana Titular Light';
src: url(\"http://eclecticgeek.com/dompdf/fonts/Elegance.ttf\") format(\"truetype\");
}
</head>
<body>
<div class='contenedor__bg'>
<div class='header'>
<div style='display: inline-block;width: 9.14cm;text-align: left;'>
<img src='img/img__logo--sep.png' style='height: 1.3cm;width: 4.37cm;'>
</div>
<div style='display: inline-block;width: 9.25cm;text-align: right; float: right;'>
<img src='img/logo__dgb__350.png' style='width: 2.3cm;'>
</div>
</div>
<div style='width: 100%;text-align: center;padding: 0.1cm 0;'>
<div style='width: 100%;font-family: SoberanaSans-Ligh;font-size: 10pt;'>SISTEMA EDUCATIVO NACIONAL</div>
**
I already tried to pull a font from the internet, I tried to add the font in webroot / font and from there get it but nothing works for me
Answer:
Hi, I would like to answer my own question in case anyone runs into the same problem as me. I put the css in the same html and to interpret the path of the font I did it as follows:
@font-face {
font-family: 'SoberanaSans-Regular';
src: url(".ROOT.DS.'webroot'.DS.'font'.DS.'SoberanaSans-Regular.ttf'.");
}
Save the font in the following path webroot / font /
I hope it helps. Thanks!