/** * Handle handler * * @return void */ public function handle() { $dompdf = new Dompdf(); $dompdf->loadHtml($this->input); $dompdf->setPaper('letter'); $dompdf->render(); //Page numbers $font = $dompdf->getFontMetrics()->getFont("Arial", "bold"); $dompdf->getCanvas()->page_text(16, 770, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 8, array(0, 0, 0)); echo $dompdf->output(); }
public function actionPdf() { $data = $this->getData(); $searchModel = $data['searchModel']; $dataProvider = $data['dataProvider']; $title = $data['title']; $modelName = $data['modelName']; $fields = $this->getFieldsKeys($searchModel->exportFields()); $options = new Options(); $options->set('defaultFont', 'times'); $dompdf = new Dompdf($options); $html = '<html><body>'; $html .= '<h1>' . $title ? $title : $modelName . '</h1>'; $html .= '<table width="100%" cellspacing="0" cellpadding="0">'; $html .= '<tr style="background-color: #ececec;">'; foreach ($fields as $one) { $html .= '<td style="border: 2px solid #cccccc; text-align: center; font-weight: 500;">' . $searchModel->getAttributeLabel($one) . '</td>'; } $html .= '</tr>'; foreach ($dataProvider->getModels() as $model) { $html .= '<tr>'; foreach ($searchModel->exportFields() as $one) { if (is_string($one)) { $html .= '<td style="border: 1px solid #cccccc; text-align: left; font-weight: 300; padding-left: 10px;">' . $model[$one] . '</td>'; } else { $html .= '<td style="border: 1px solid #cccccc; text-align: left; font-weight: 300; padding-left: 10px;">' . $one($model) . '</td>'; } } $html .= '</tr>'; } $html .= '</table>'; $html .= '</body></html>'; $dompdf->loadHtml($html); $dompdf->setPaper('A4', 'landscape'); $dompdf->render(); $dompdf->stream($modelName . '_' . time()); }
/** * Get a fresh dompdf instance * * @param array $options * @return Dompdf The dompdf instance */ protected function makeDompdf(array $options) { $dompdf = new Dompdf(); $options = $options + $this->options; if (isset($options['paper'])) { $paper = $options['paper']; } else { $paper = 'a4'; } if (isset($options['orientation'])) { $orientation = $options['orientation']; } else { $orientation = 'portrait'; } $dompdf->setPaper($paper, $orientation); return $dompdf; }
/** * Render the PDF */ protected function render() { if (!$this->dompdf) { throw new Exception('DOMPDF not created yet'); } $this->dompdf->setPaper($this->paper, $this->orientation); $this->dompdf->render(); if ($this->showWarnings) { global $_dompdf_warnings; if (count($_dompdf_warnings)) { $warnings = ''; foreach ($_dompdf_warnings as $msg) { $warnings .= $msg . "\n"; } // $warnings .= $this->dompdf->get_canvas()->get_cpdf()->messages; if (!empty($warnings)) { throw new Exception($warnings); } } } $this->rendered = true; }
/** * Background image Size: 1343x929 (Aspect ratio: 1.45:1) * * * @param \stdClass $obj * @param string $dateFrom * @param string $dateTo * @param string $bgImage * @param string $tpl * @param string $paperSize * @param string $paperOrientation * @return Dompdf */ protected function makeCert($obj, $dateFrom = '', $dateTo = '', $bgImage = '', $tpl = '', $paperSize = 'A4', $paperOrientation = 'landscape') { $now = \Tk\Date::create(); if (!$dateFrom) { $dateFrom = \Tk\Date::create($now->getYear() . '-01-01')->floor()->toString(\Tk\Date::LONG_DATE); } if (!$dateTo) { $dateTo = \Tk\Date::create($now->getYear() . '-12-31')->ceil()->toString(\Tk\Date::LONG_DATE); } if (!$bgImage) { $bgImage = \Tk\Url::create('/data/pdfTestBg.png')->toString(); } if (!$tpl) { $tpl = '<div class="content"> <p class="med">Certificate of Appreciation</p> <p class="med">The Faculty of Veterinary Science gratefully acknowledges the support of</p> <p class="lg bld">{name}</p> <p class="med">for mentoring and training veterinary students from</p> <p class="med">The University of Melbourne</p> <p class="med">{dateFrom} - {dateTo}</p> </div>'; } // Format content template $tpl = str_replace('{name}', $obj->name, $tpl); $tpl = str_replace('{date}', $now->format(\Tk\Date::LONG_DATE), $tpl); $tpl = str_replace('{dateFrom}', $dateFrom, $tpl); $tpl = str_replace('{dateTo}', $dateTo, $tpl); $tpl = str_replace('{year}', $now->toString('Y'), $tpl); $tpl = str_replace('{totalUnits}', $obj->totalUnits, $tpl); $tpl = str_replace('{totalPlaces}', $obj->totalPlaces, $tpl); $html = <<<ENDHTML <html> <head> <title>Test HTML2PDF</title> <style> @page { margin: 0px; } body { font-family: sans-serif; font-size: 10pt; margin: 0px; } div.cert { width: 1122px; position: absolute; top: 0; left: 0; } div.cert img { width: 100%; } div.content { position: absolute; top: {$this->setup->pdfTopMargin}px; left: 0; line-height: 1.2em; text-align: center; } .lg { font-size: 20pt; } .med { font-size: 16pt; } .sml { font-size: 8pt } .bld { font-weight: bold; } </style> </head> <body> <div class="cert"> <img src="{$bgImage}" alt="" /> </div> {$tpl} </body> </html> ENDHTML; set_time_limit(300); ini_set('memory_limit', '-1'); $dompdf = new Dompdf(array('enable_remote' => true)); $dompdf->setPaper($paperSize, $paperOrientation); $dompdf->loadHtml($html); $dompdf->render(); return $dompdf; }
$OrderNo = $_POST['inputOrderNo']; $html = $_POST['submitContent']; $chargebackFolder = '../../public/chargebacks'; $workingFolder = $chargebackFolder . '/' . $OrderNo; if (!file_exists($workingFolder)) { mkdir($workingFolder, 0777, true); } // include autoloader require_once '../../php/plugins/dompdf/autoload.inc.php'; // reference the Dompdf namespace use Dompdf\Dompdf; // instantiate and use the dompdf class $dompdf = new Dompdf(); $dompdf->loadHtml($html); // (Optional) Setup the paper size and orientation $dompdf->setPaper('A4', 'portrait'); // Render the HTML as PDF $dompdf->render(); $Letter1 = '1_Letter_' . $OrderNo . '.pdf'; file_put_contents($workingFolder . '/' . $Letter1, $dompdf->output()); // Output the generated PDF to Browser //$dompdf->stream(); $Invoice2 = ''; //inputFileInvoice if (isset($_FILES['inputFileInvoice']) && $_FILES['inputFileInvoice']['error'] == UPLOAD_ERR_OK) { $info = pathinfo($_FILES['inputFileInvoice']['name']); $ext = $info['extension']; // get the extension of the file $newname = '2_Invoice_' . $OrderNo . '.' . $ext; $target = $workingFolder . '/' . $newname; move_uploaded_file($_FILES['inputFileInvoice']['tmp_name'], $target);
function create_registration_data_details($user) { $dompdf = new Dompdf(); $message = $this->get_account_confirmation_message($user, true); $dompdf->loadHtml($message); $dompdf->setPaper('A4', 'portrait'); $dompdf->render(); $output = $dompdf->output(); $file_path = $this->registration_path . "/{$user->email}.pdf"; file_put_contents($file_path, $output); }
$dompdf = new Dompdf(); $dompdf->set_option('isHtml5ParserEnabled', true); //html $html = file_get_contents('../public/mauBang/file_html_img.html'); $html = str_replace('{_name}', $name, $html); $html = str_replace('{_course}', $course, $html); $html = str_replace('{_img_signature1}', $img_signature1, $html); $html = str_replace('{_logo_signature1}', $logo_signature1, $html); $html = str_replace('{_name_signature1}', $name_signature1, $html); $html = str_replace('{_position_signature1}', $position_signature1, $html); $html = str_replace('{_img_signature2}', $img_signature2, $html); $html = str_replace('{_logo_signature2}', $logo_signature2, $html); $html = str_replace('{_name_signature2}', $name_signature2, $html); $html = str_replace('{_position_signature2}', $position_signature2, $html); $html = str_replace('{_pdu}', $pdu, $html); $html = str_replace('{_code}', $code, $html); $html = str_replace('{_date}', $date, $html); $dompdf->loadHtml($html); //end html //(Optional) Setup the paper size and orientation $dompdf->setPaper('A4', 'landscape'); //portrait, landscape //Render the HTML as PDF $dompdf->render(); //Stream - Output the generated PDF to Browser //$dompdf->output(); $dompdf->stream('certificate'); //$dompdf->stream('certificate', array("Attachment" => false)); exit(0); } /*end dompdf*/
function create_user_invoice($user, $group, $participants) { $late = new Late(); $user_installment_status = $this->is_installment_user($user->id, $user->courseid); if ($user_installment_status == 0) { if ($group == null) { $cost = $this->get_personal_course_cost($user->courseid); // cost, discount $item_name = $this->get_course_name($user->courseid); $tax_status = $this->is_course_taxable($user->courseid); // Get invoice user data $user_data = $this->get_invoice_user_data($user->id); if ($tax_status == 1) { $user_state = $this->get_user_state($user->id); $tax = $this->get_state_taxes($user_state); } else { $tax = 0; } // end else if (!property_exists($user, 'slotid')) { $user->slotid = 0; } $apply_delay_fee = $late->is_apply_delay_fee($user->courseid, $user->slotid); $late_fee = $late->get_delay_fee($user->courseid); } else { $group_data = $_SESSION['group_common_section']; $participants = $participants == null ? $_SESSION['tot_participants'] : $participants; $cost = $this->get_course_group_discount($group_data->courseid, $participants); // cost, discount $item_name = $this->get_course_name($group_data->courseid); $tax_status = $this->is_course_taxable($group_data->courseid); if ($tax_status == 1) { $user_state = $group_data->statename; $tax = $this->get_state_taxes($user_state); } else { $tax = 0; } // end else if (!property_exists($group_data, 'slotid')) { $group_data->slotid = 0; } $apply_delay_fee = $late->is_apply_delay_fee($group_data->courseid, $group_data->slotid); $late_fee = $late->get_delay_fee($group_data->courseid); // Get invoice user data $user_data = new stdClass(); $user_data->group_name = $group_data->group_name; $user_data->address = $group_data->addr; $user_data->city = $group_data->city; $user_data->state = $group_data->statename; $user_data->zip = $group_data->zip; } // end else when it is group members } else { $installment = $this->get_user_installment_payments($user->id, $user->courseid); $cost['cost'] = $installment->sum; $cost['discount'] = 0; $item_name = $this->get_course_name($user->courseid); $tax_status = $this->is_course_taxable($user->courseid); if ($tax_status == 1) { $user_state = $this->get_user_state($user->id); $tax = $this->get_state_taxes($user_state); } else { $tax = 0; } // end else $user->slotid = 0; // It is always 0 for installment users $apply_delay_fee = $late->is_apply_delay_fee($user->courseid, $user->slotid); $late_fee = $late->get_delay_fee($user->courseid); // Get invoice user data $user_data = $this->get_invoice_user_data($user->id); } // end else when installment is active if ($cost['discount'] > 0) { $amount = '$' . $cost['cost'] . ' (discount is ' . $cost['discount'] . '%)'; } else { $amount = '$' . $cost['cost']; } $invoice_credentials = $this->get_invoice_credentials(); $invoice_num = $this->get_invoice_num(); $list = ""; $list .= "<html>"; $list .= "<body>"; $list .= "<p></p>"; $list .= "<br/><br/><table border='0' align='center' style='width:100%;table-layout:fixed;'>"; $list .= "<tr>"; $list .= "<td colspan='2' width='55%' style=''><img src='" . $_SERVER['DOCUMENT_ROOT'] . "/assets/logo/5.png' width='350' height=90></td><td style='padding-left:10px;padding-right:10px;border-left:1px solid;' width='45%'>Phone: {$invoice_credentials->phone}<br/>Fax: {$invoice_credentials->fax}</td>"; $list .= "</tr>"; $list .= "<tr>"; $list .= "<td colspan='3' style='border-bottom:1px solid;padding-top:1px;height:10px;'></td>"; $list .= "</tr>"; $list .= "<tr>"; $list .= "<td style='padding-top:6px;' colspan='2'>No: {$invoice_num}</td><td style='padding-left:10px;'>Date: " . date('Y/m/d', time()) . "</td>"; $list .= "</tr>"; $list .= "<tr style=''>"; $list .= "<td colspan='3' style='padding-top:1px;height:35px;'></td>"; $list .= "</tr>"; $list .= "<tr bgcolor='black'>"; $list .= "<td style='text-align:center;color:black;' width='15' height='15'> </td><td style='padding-left:15px;text-align:left;' width='10%' bgcolor='white'><span style='color:#ff8000;font-weight:bolder;'>INVOICE TO </span></td><td style='text-align:left;color:black;padding-left:15px;'> </td>"; $list .= "</tr>"; // Calculate item block if ($user_data->group_name == '') { // Single registration $item_block = "{$user_data->firstname} {$user_data->lastname}<br/> payment for {$item_name}"; $list .= "<tr>"; $list .= "<td colspan='3'>{$user_data->firstname} {$user_data->lastname}<br/>{$user_data->address}<br/> {$user_data->state}" . "/" . $user_data->city . "<br/>{$user_data->zip}</td>"; $list .= "</tr>"; } else { // Group registration $item_block = "{$user_data->group_name}<br/> payment for {$item_name}"; //$item_block = "$user_data->firstname $user_data->lastname<br/> payment for $item_name"; $list .= "<tr>"; $list .= "<td colspan='3'>{$user_data->group_name}<br/>{$user_data->address}<br/> {$user_data->state}" . "/" . $user_data->city . "<br/>{$user_data->zip}</td>"; $list .= "</tr>"; } // end else $list .= "<tr>"; $list .= "<td colspan='3' style='border-bottom:0px solid;padding-top:1px;height:40px;'></td>"; $list .= "</tr>"; $list .= "<tr bgcolor='black'>"; $list .= "<td style='color:white;text-align:center' width='10%'>No</td><td style='padding-left:15px;text-align:left;color:white' width='60%'>Description</td><td style='text-align:left;color:white;padding-left:15px;' width='5%'>Amount</td>"; $list .= "</tr>"; $list .= "<tr bgcolor='#FAF7F5'>"; $grand_total = $apply_delay_fee == true ? $cost['cost'] + $late_fee : $cost['cost']; if ($apply_delay_fee) { $list .= "<td style='text-align:center;color:black;' width='10%' height='55'>1</td><td style='padding-left:15px;text-align:left;color:black' width='60%'>{$item_block}</td><td style='text-align:left;color:black;padding-left:15px;' width='5%'>\${$grand_total} (late fee of \${$late_fee} is applied)</td>"; } else { $list .= "<td style='text-align:center;color:black;' width='10%' height='55'>1</td><td style='padding-left:15px;text-align:left;color:black' width='60%'>{$item_block}</td><td style='text-align:left;color:black;padding-left:15px;' width='5%'>\${$grand_total} </td>"; } $list .= "</tr>"; $list .= "<tr>"; $list .= "<td></td><td style='padding:10px;' align='right'>Subtotal</td><td bgcolor='black' style='color:white;padding-left:15px;'>\$" . $grand_total . "</td>"; $list .= "</tr>"; if ($tax == 0) { $list .= "<tr>"; $list .= "<td></td><td style='padding:10px;' align='right'>Tax</td><td bgcolor='black' style='padding-left:15px;color:white;'>\$0</td>"; $list .= "</tr>"; $list .= "<tr>"; $list .= "<td></td><td style='padding:10px;' align='right'>Total</td><td bgcolor='black' style='padding-left:15px;color:white;'>\$" . $grand_total . "</td>"; $list .= "</tr>"; } else { $tax_sum = round($cost['cost'] * $tax / 100, 2); $grand_total = round($cost['cost'] + $tax_sum, 2); $grand_total2 = $apply_delay_fee == true ? $grand_total + $late_fee : $grand_total; $list .= "<tr>"; $list .= "<td></td><td style='padding:10px;' align='right'>Tax</td><td bgcolor='black' style='padding-left:15px;color:white;'>\${$tax_sum}</td>"; $list .= "</tr>"; $list .= "<tr>"; $list .= "<td></td><td style='padding:10px;' align='right'>Total</td><td bgcolor='black' style='padding-left:15px;color:white;'>\$" . $grand_total2 . "</td>"; $list .= "</tr>"; } // end else when tax is not null $list .= "<tr>"; $list .= "<td colspan='3' style='border-bottom:0px solid;padding-top:1px;height:55px;'></td>"; $list .= "</tr>"; /* $list.="<tr bgcolor='#ff8000'>"; $list.="<td colspan='3' height='35px' style='color:white;fonr-weight:bold;' align='center'>Mailing Address: Medical2 1830A North Gloster St, Tupelo, MS 38804 </td>"; $list.="</tr>"; */ $list .= "<tr bgcolor='#ff8000'>"; $list .= "<td colspan='3' height='35px' style='color:white;fonr-weight:bold;' align='center'>email: " . $invoice_credentials->email . " " . $invoice_credentials->site . "<br>Mailing Address: Medical2 1830A North Gloster St, Tupelo, MS 38804 </td>"; $list .= "</tr>"; $list .= "</table>"; $list .= "</body>"; $list .= "</html>"; // instantiate and use the dompdf class $dompdf = new Dompdf(); $dompdf->loadHtml($list); // (Optional) Setup the paper size and orientation $dompdf->setPaper('A4', 'portrait'); // Render the HTML as PDF $dompdf->render(); $output = $dompdf->output(); $file_path = $this->invoice_path . "/{$invoice_num}.pdf"; file_put_contents($file_path, $output); return $invoice_num; }
function add_user_payment($activity) { if ($activity->pstatus == 0) { $courseid = $this->get_course_id($activity->courseid); $userid = $this->get_user_id_by_uid($activity->uid); if (strtolower($activity->ptype) != 'cc') { $invoice_status = $this->is_invoice_exists($courseid, $userid); //echo "Invoice exists: " . $invoice_status . "<br>"; if ($invoice_status == 0) { $invoice_credentials = $this->get_invoice_credentials(); $invoice_num = $this->get_invoice_num(); $user_data = $this->get_invoice_user_data($userid); switch (strtolower($activity->ptype)) { case 'cash': $ptype = 1; break; case 'cheque': $ptype = 2; break; case 'free': $ptype = 3; break; default: $ptype = 1; } if ($ptype == 3) { $activity->amount = 0; } // ******************** Make invoice ********************* $list = ""; $list .= "<html>"; $list .= "<body>"; $list .= "<p></p>"; $list .= "<br/><br/><table border='0' align='center' style='width:100%;table-layout:fixed;'>"; $list .= "<tr>"; $list .= "<td colspan='2' width='55%' style=''><img src='" . $_SERVER['DOCUMENT_ROOT'] . "/assets/logo/5.png' width='350' height=90></td><td style='padding-left:10px;padding-right:10px;border-left:1px solid;' width='45%'>Phone: {$invoice_credentials->phone}<br/>Fax: {$invoice_credentials->fax}</td>"; $list .= "</tr>"; $list .= "<tr>"; $list .= "<td colspan='3' style='border-bottom:1px solid;padding-top:1px;height:10px;'></td>"; $list .= "</tr>"; $list .= "<tr>"; $list .= "<td style='padding-top:6px;' colspan='2'>No: {$invoice_num}</td><td style='padding-left:10px;'>Date: " . $activity->regdate . "</td>"; $list .= "</tr>"; $list .= "<tr style=''>"; $list .= "<td colspan='3' style='padding-top:1px;height:35px;'></td>"; $list .= "</tr>"; $list .= "<tr bgcolor='black'>"; $list .= "<td style='text-align:center;color:black;' width='15' height='15'> </td><td style='padding-left:15px;text-align:left;' width='10%' bgcolor='white'><span style='color:#ff8000;font-weight:bolder;'>INVOICE TO </span></td><td style='text-align:left;color:black;padding-left:15px;'> </td>"; $list .= "</tr>"; $list .= "<tr>"; $list .= "<td colspan='3'>{$user_data->firstname} {$user_data->lastname}<br/>{$user_data->address}<br/> {$user_data->state}" . "/" . $user_data->city . "<br/>{$user_data->zip}</td>"; $list .= "</tr>"; $list .= "<tr>"; $list .= "<td colspan='3' style='border-bottom:0px solid;padding-top:1px;height:40px;'></td>"; $list .= "</tr>"; $list .= "<tr bgcolor='black'>"; $list .= "<td style='color:white;text-align:center' width='10%'>No</td><td style='padding-left:15px;text-align:left;color:white' width='60%'>Description</td><td style='text-align:left;color:white;padding-left:15px;' width='5%'>Amount</td>"; $list .= "</tr>"; $grand_total = $activity->amount; $item_name = $this->get_course_name($courseid); $item_block = "{$user_data->firstname} {$user_data->lastname}<br/> payment for {$item_name}"; $list .= "<tr bgcolor='#FAF7F5'>"; $list .= "<td style='text-align:center;color:black;' width='10%' height='55'>1</td><td style='padding-left:15px;text-align:left;color:black' width='60%'>{$item_block}</td><td style='text-align:left;color:black;padding-left:15px;' width='5%'>\${$grand_total} </td>"; $list .= "</tr>"; $list .= "<tr>"; $list .= "<td></td><td style='padding:10px;' align='right'>Tax</td><td bgcolor='black' style='padding-left:15px;color:white;'>\$0</td>"; $list .= "</tr>"; $list .= "<tr>"; $list .= "<td></td><td style='padding:10px;' align='right'>Total</td><td bgcolor='black' style='padding-left:15px;color:white;'>\$" . $grand_total . "</td>"; $list .= "</tr>"; $list .= "<tr bgcolor='#ff8000'>"; $list .= "<td colspan='3' height='35px' style='color:white;fonr-weight:bold;' align='center'>email: " . $invoice_credentials->email . " " . $invoice_credentials->site . "<br>Mailing Address: Medical2 1830A North Gloster St, Tupelo, MS 38804 </td>"; $list .= "</tr>"; $list .= "</table>"; $list .= "</body>"; $list .= "</html>"; $dompdf = new Dompdf(); $dompdf->loadHtml($list); // (Optional) Setup the paper size and orientation $dompdf->setPaper('A4', 'portrait'); // Render the HTML as PDF $dompdf->render(); $output = $dompdf->output(); $file_path = $this->invoice_path . "/{$invoice_num}.pdf"; file_put_contents($file_path, $output); $query = "insert into mdl_invoice " . "(i_num," . "userid," . "courseid," . "renew," . "i_sum," . "i_status," . "i_file," . "i_ptype," . "i_date," . "i_pdate) " . "values('{$invoice_num}'," . "'{$userid}'," . "'{$courseid}'," . "'0'," . "'{$activity->amount}'," . "'1'," . "'{$file_path}'," . "'{$ptype}'," . "'" . strtotime($activity->regdate) . "'," . "'" . strtotime($activity->pdate) . "')"; $this->db->query($query); echo "<br>Payment data for user ({$activity->uid}) was created<br>"; } else { echo "<br>Invoice data for for user ({$activity->uid}) already exists <br>"; } } else { $card_payment_exists = $this->is_card_payment_exists($courseid, $userid); //echo "Card Payment status: " . $card_payment_exists . "<br>"; if ($card_payment_exists == 0) { $query = "insert into mdl_card_payments" . "(userid," . "courseid," . "psum," . "trans_id," . "auth_code," . "pdate) " . "values('{$userid}'," . "'{$courseid}'," . "'{$activity->amount}'," . "'imported'," . "'00'," . "'" . strtotime($activity->pdate) . "')"; $this->db->query($query); echo "<br>Payment data for user ({$activity->uid}) was created<br>"; } else { echo "<br>Credit card payment data for user ({$activity->uid}) already exists <br>"; echo "Echo Credit Card payment date: " . $activity->pdate . "<br>"; } } // end else payment made by CC card } // end if $activity->pstatus==0 }
function create_assignment_pdf($moduleid) { $query = "select * from mdl_course_modules where id={$moduleid}"; $result = $this->db->query($query); while ($row = $result->fetch(PDO::FETCH_ASSOC)) { $instanceid = $row['instance']; } $query = "select * from mdl_assign where id={$instanceid}"; $result = $this->db->query($query); while ($row = $result->fetch(PDO::FETCH_ASSOC)) { $html = $row['intro']; } $dompdf = new Dompdf(); $dompdf->loadHtml($html); // (Optional) Setup the paper size and orientation $dompdf->setPaper('A4', 'portrait'); // Render the HTML as PDF $dompdf->render(); $output = $dompdf->output(); $file_path = $this->assesment_path . "/assesment_{$instanceid}.pdf"; file_put_contents($file_path, $output); $path = "https://" . $_SERVER['SERVER_NAME'] . "/lms/custom/my/assesment_{$instanceid}.pdf"; return $path; }
public function printTest() { $dompdf = new Dompdf(); $dompdf->loadHtml('Hello world'); $dompdf->setPaper('A4', 'Landscape'); $dompdf->render(); $dompdf->stream(); }