Skip to content

Commit

Permalink
fix: Update PDFGenerator.php
Browse files Browse the repository at this point in the history
  • Loading branch information
podarok authored May 10, 2023
1 parent f6e4d8d commit 928a661
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PDFGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public function generatePdf($settings) {
$temporary_directory = \Drupal::service('file_system')->getTempDirectory();
define("_MPDF_TEMP_PATH", $temporary_directory);
ini_set("pcre.backtrack_limit", "5000000");
$html = mb_convert_encoding(render($settings['body']), 'UTF-8', 'UTF-8');
$html = mb_convert_encoding(\Drupal::service('renderer')->render($settings['body']), 'UTF-8', 'UTF-8');
$mpdf = new Mpdf(['format' => 'A4-L', 'tempDir' => $temporary_directory]);
$stylesheet = file_get_contents(\Drupal::service('extension.list.module')->getPath('openy_repeat') . '/css/print_pdf.css');
$mpdf->SetTitle($settings['title']);
$mpdf->SetHTMLFooter(render($settings['footer']));
$mpdf->SetHTMLFooter(\Drupal::service('renderer')->render($settings['footer']));
$mpdf->WriteHTML($stylesheet, 1);
$mpdf->WriteHTML($html, 2);
$download_title = array_key_first($settings["body"]["#content"]["result"]) . ' ';
Expand Down

0 comments on commit 928a661

Please sign in to comment.