'dompdf_font_dir' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'dompdf_chroot' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'dompdf_enable_remote' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
- 'weasyprintPath' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
+ 'weasyprint_path' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'wkhtmltopdfPath' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'recentItemsMaxCount' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'recentItemsProviders' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
$errors['recentItemsMaxCount'] = ts("Illegal stack size. Use values between 1 and %1.", [1 => CRM_Utils_Recent::MAX_ITEMS]);
}
- if (!empty($fields['weasyprintPath'])) {
+ if (!empty($fields['weasyprint_path'])) {
// check and ensure that this path leads to the weasyprint binary
// and it is a valid executable binary
// Only check the first space separated piece to allow for a value
- // such as /usr/bin/xvfb-run -- weasyprintPath (CRM-13292)
- $pieces = explode(' ', $fields['weasyprintPath']);
+ // such as /usr/bin/xvfb-run -- weasyprint (CRM-13292)
+ $pieces = explode(' ', $fields['weasyprint_path']);
$path = $pieces[0];
if (
!file_exists($path) ||
!is_executable($path)
) {
- $errors['weasyprintPath'] = ts('The weasyprintPath does not exist or is not valid');
+ $errors['weasyprint_path'] = ts('The path for %1 does not exist or is not valid', [1 => 'weasyprint']);
}
}
if (!empty($fields['wkhtmltopdfPath'])) {
</div>
</body>
</html>";
- if (\Civi::settings()->get('weasyprintPath')) {
+ if (\Civi::settings()->get('weasyprint_path')) {
return self::_html2pdf_weasyprint($paper_size, $orientation, $margins, $html, $output, $fileName);
}
elseif (\Civi::settings()->get('wkhtmltopdfPath')) {
*/
public static function _html2pdf_weasyprint($paper_size, $orientation, $margins, $html, $output, $fileName) {
require_once 'php-weasyprint/src/autoload.php';
- $weasyprint = new Pontedilana\PhpWeasyPrint\Pdf(\Civi::settings()->get('weasyprintPath'));
+ $weasyprint = new Pontedilana\PhpWeasyPrint\Pdf(\Civi::settings()->get('weasyprint_path'));
$weasyprint->setOption("page-width", $paper_size[2] . "pt");
$weasyprint->setOption("page-height", $paper_size[3] . "pt");
$weasyprint->setOption("orientation", $orientation);
'help_text' => NULL,
'add' => '5.43',
],
- 'weasyprintPath' => [
+ 'weasyprint_path' => [
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
- 'name' => 'weasyprintPath',
+ 'name' => 'weasyprint_path',
'type' => 'String',
'quick_form_type' => 'Element',
'html_attributes' => [
<p class="description">{ts}Enable the use of remote images. By default this is enabled, but if not using remote images you may wish to turn it off for security reasons.{/ts}</p>
</td>
</tr>
- <tr class="crm-miscellaneous-form-block-weasyprintPath">
- <td class="label">{$form.weasyprintPath.label}</td>
- <td>{$form.weasyprintPath.html}<br />
+ <tr class="crm-miscellaneous-form-block-weasyprint_path">
+ <td class="label">{$form.weasyprint_path.label}</td>
+ <td>{$form.weasyprint_path.html}<br />
<p class="description">{ts 1="https://weasyprint.org/"}<a href="%1">weasyprint is an alternative utility for generating PDFs</a> which is a successor to the discontinued wkhtmltopdf. Your system administrator will need to download and install this utility, and enter the executable path here.{/ts}</p>
</td>
</tr>