- public static function putFile($html, $name = 'Invoice.pdf') {
- $options = new Options();
- $options->set('isRemoteEnabled', TRUE);
-
- $doc = new DOMPDF($options);
- $doc->load_html($html);
- $doc->render();
- $html = $doc->output();
- $config = CRM_Core_Config::singleton();
- $fileName = $config->uploadDir . $name;
- file_put_contents($fileName, $html);
- return $fileName;
+ public static function putFile($html, $name = 'Invoice.pdf', $format = NULL) {
+ return CRM_Utils_Mail::appendPDF($name, $html, $format)['fullPath'] ?? '';