htmlTemplate = $htmlContent; } public function generateSettlementsPDF($userinvoice = null) { $dompdf = new Dompdf(); $options = $dompdf->getOptions(); $dompdf->set_option('defaultFont', 'DejaVu Sans'); $dompdf->setOptions($options); $html = ' '; $html .= $this->htmlTemplate; $html .= ''; $dompdf->loadHtml($html, 'UTF-8'); $dompdf->setPaper('A4', 'portrai'); $dompdf->render(); $fname = time() . '_' . uniqid(); $filename = $fname . '.pdf'; $directory_path = '/var/www/html/documents/settlements/pdf/'; //$custompath = date('Y') . '/' . date('m') . '/' . if (!is_dir($directory_path)) { mkdir($directory_path, 0775, true); chmod($directory_path, 0775); } if (is_null($userinvoice)) { $full_path = $directory_path . $filename; } else { $full_path = $directory_path . $userinvoice . '/' . $filename; } $pdf_gen = $dompdf->output(); file_put_contents($full_path, $pdf_gen); //$dompdf->stream($fname,array("Attachment"=>0)); return $full_path; } public function generateCommissionSettlementsPDF() { $dompdf = new Dompdf(); $options = $dompdf->getOptions(); $dompdf->set_option('defaultFont', 'DejaVu Sans'); $dompdf->setOptions($options); $html = ' '; $html .= $this->htmlTemplate; $html .= ''; $dompdf->loadHtml($html, 'UTF-8'); $dompdf->setPaper('A4', 'portrai'); $dompdf->render(); $fname = time() . '_' . uniqid(); $filename = $fname . '.pdf'; $directory_path = '/var/www/html/documents/settlements/pdf/commissionsettlements/'; if (!is_dir($directory_path)) { mkdir($directory_path, 0775, true); chmod($directory_path, 0775); } //$custompath = date('Y') . '/' . date('m') . '/' . $full_path = $directory_path . $filename; $pdf_gen = $dompdf->output(); file_put_contents($full_path, $pdf_gen); //$dompdf->stream($fname,array("Attachment"=>0)); return $full_path; } public function generateDailyClosuingCheckoutClosurePDF() { $dompdf = new Dompdf(); $options = $dompdf->getOptions(); $dompdf->set_option('defaultFont', 'DejaVu Sans'); $dompdf->setOptions($options); $html = ' '; $html .= $this->htmlTemplate; $html .= ''; $dompdf->loadHtml($html, 'UTF-8'); $dompdf->setPaper('A4', 'portrai'); $dompdf->render(); $fname = time() . '_' . uniqid(); $filename = $fname . '.pdf'; $directory_path = '/var/www/html/documents/settlements/pdf/dailyclosingcheckoutclosure/'; //$custompath = date('Y') . '/' . date('m') . '/' . $full_path = $directory_path . $filename; $pdf_gen = $dompdf->output(); file_put_contents($full_path, $pdf_gen); //$dompdf->stream($fname,array("Attachment"=>0)); return $full_path; } public function generateVoucherPDF() { $dompdf = new Dompdf(); $options = $dompdf->getOptions(); $dompdf->set_option('defaultFont', 'DejaVu Sans'); $dompdf->setOptions($options); $html = ' '; $html .= $this->htmlTemplate; $html .= ''; $dompdf->loadHtml($html, 'UTF-8'); $dompdf->setPaper('A4', 'portrai'); $dompdf->render(); $fname = 'voucher_' . time() . '_' . uniqid(); $filename = $fname . '.pdf'; $directory_path = '/var/www/html/documents/voucher/pdf/voucher/'; if (!is_dir($directory_path)) { mkdir($directory_path, 0775, true); chmod($directory_path, 0775); } //$custompath = date('Y') . '/' . date('m') . '/' . $full_path = $directory_path . $filename; $pdf_gen = $dompdf->output(); file_put_contents($full_path, $pdf_gen); //$dompdf->stream($fname,array("Attachment"=>0)); return $full_path; } }