class CreatePdfProduct
{
public static function create($html) {
$dompdf = new Dompdf();
//$dompdf->set_option('isRemoteEnabled', TRUE);
$dompdf->setPaper('A4', 'portrait');
$dompdf->loadHtml($html, 'UTF-8');
$dompdf->render();
global $APPLICATION;
$output = $dompdf->output();
$receiptLink = '/upload/products/product_' . rand(1,99999999) .'.pdf';
$APPLICATION->SaveFileContent($_SERVER["DOCUMENT_ROOT"] . $receiptLink, $output);
$arFile = \CFile::MakeFileArray($_SERVER["DOCUMENT_ROOT"] . $receiptLink);
$fid = \CFile::SaveFile($arFile, 'productsPDF');
unlink($receiptLink);
$path = \CFile::GetPath($fid);
return $path;
}
}