PHP code example of aklump / dompdf-fonts
1. Go to this page and download the library: Download aklump/dompdf-fonts library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aklump / dompdf-fonts example snippets
$options = new \Dompdf\Options();
// Determine the configuration directory by reading the import config.
$fonts_base_path = \Drupal::service('extension.list.module')
->getPath('my_module') . '/fonts';
$fonts_config = \Symfony\Component\Yaml\Yaml::parseFile($fonts_base_path . '/dompdf-fonts.config.yml');
$fonts_dir = realpath($fonts_base_path . '/' . $fonts_config['output']['path']);
$options->setFontDir($fonts_dir);
$dompdf = new \Dompdf\Dompdf($options);