formations[$post_id]; // print_r($go_data); // Timber::$dirname = 'lib/formations'; $content = Timber::compile( 'lma_formation_export_pdf-twig.html', $context ); require_once __DIR__ . '/../vendor/autoload.php'; if(@$_GET['mode']=='debug'){ echo ''; echo ""; echo ''; echo $content; // debug // print_r($la_questions2); //print_r($context); if ($context!='') { echo ''; echo ''; // echo ''; } echo ''; } else{ $defaultConfig = (new Mpdf\Config\ConfigVariables())->getDefaults(); $fontDirs = $defaultConfig['fontDir']; $defaultFontConfig = (new Mpdf\Config\FontVariables())->getDefaults(); $fontData = $defaultFontConfig['fontdata']; // $mpdf = new \Mpdf\Mpdf(); $mpdf = new \Mpdf\Mpdf([ 'fontDir' => array_merge($fontDirs, [ __DIR__ . '/fonts', ]), 'fontdata' => [ 'opensans' => [ 'R' => 'OpenSans-Regular.ttf', ], 'yanone' => [ 'R' => 'YanoneKaffeesatz-Regular.ttf', ], 'yanonelight' => [ 'R' => 'YanoneKaffeesatz-Light.ttf', ], 'bitter-reg' => [ 'R' => 'Bitter-Regular.ttf', ], 'bitter-bold' => [ 'R' => 'Bitter-Bold.ttf', ] ], 'default_font' => 'opensans', 'orientation' => 'P', 'margin_footer' => 0, 'setAutoTopMargin' => 'pad', 'margin-top' => 0, 'margin_header' => 5, 'setAutoBottomMargin' => 'pad', 'margin-bottom' => 0, ]); if($stylesheet = file_get_contents( get_template_directory() . '/fiche-pdf.css')) $mpdf->WriteHTML($stylesheet, 1); $mpdf->WriteHTML($content); $mpdf->Output($context['titre'] . ".pdf", "I"); }