$tool_path), WATCHDOG_ERROR); throw new Exception("Configured PDF tool does not exist, unable to generate PDF."); } $format = ($page_orientation == "landscape") ? $paper_size . "-L" : $paper_size; // Try to use local file access for image files. $html = _print_access_images_via_file($html, $images_via_file); // Set document information. if ($mpdf_version_7_plus) { $config['mode'] = 'utf-8'; $config['format'] = $format; $mpdf = new \Mpdf\Mpdf($config); } else { $mpdf = new mPDF('UTF-8', $format); } if (isset($meta['name'])) { $mpdf->SetAuthor(strip_tags($meta['name'])); } $mpdf->SetCreator(variable_get('site_name', 'Drupal')); /* // Pulled from the HTML meta data $mpdf->SetTitle(html_entity_decode($meta['title'], ENT_QUOTES, 'UTF-8')); $keys = implode(' ', explode("\n", trim(strip_tags($print['taxonomy'])))); $mpdf->SetKeywords($keys); // Encrypt the file and grant permissions to the user to copy and print // No password is required to open the document // Owner has full rights using the password "MyPassword" $mpdf->SetProtection(array('copy', 'print'), '', 'MyPassword'); $mpdf->SetProtection(array('copy', 'print', 'print-highres'), '', ''); */ drupal_alter('print_pdf_mpdf', $mpdf, $html, $meta); $mpdf->WriteHTML($html); // Try to recover from any warning/error. ob_clean(); return $mpdf->Output('', 'S'); }