本文整理汇总了PHP中Pdf::WriteHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP Pdf::WriteHTML方法的具体用法?PHP Pdf::WriteHTML怎么用?PHP Pdf::WriteHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pdf
的用法示例。
在下文中一共展示了Pdf::WriteHTML方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
public function create()
{
$this->load->library('Mpdf');
$html = "<b>Ví Dụ</b><br />Xuất file PDF";
$mpdf = new Pdf();
$mpdf->SetAutoFont(AUTOFONT_ALL);
$mpdf->WriteHTML($html);
$mpdf->Output("file/mpdf.pdf", 'I');
}
示例2: outputPdfFile
//.........这里部分代码省略.........
$strHtml .= $arrDate[2] . "/" . $arrDate[1] . "/" . $arrDate[0];
} else {
$strHtml .= "Unknown";
}
break;
case 'datetime':
$arrDateTime = explode(' ', $objItem->{$arrReportField['strFieldReference']});
$strTime = $arrDateTime[1];
$arrDate = explode('-', $arrDateTime[0]);
$strHtml .= $arrDate[2] . "/" . $arrDate[1] . "/" . $arrDate[0] . " " . $strTime;
break;
case 'pat_result':
if ($objItem->{$arrReportField['strFieldReference']} === null) {
$strHtml.="-";
} else {
if ($objItem->{$arrReportField['strFieldReference']} == 1) {
$strHtml.="Pass";
} else {
$strHtml.="Fail";
}
}
break;
case 'price':
$strHtml .= $currency . $objItem->{$arrReportField['strFieldReference']};
break;
case 'img':
if ($objItem['photo_id']) {
if (strpos($objItem['photo_id'], ',')) {
$photos = explode(',', $objItem['photo_id']);
for ($i = 0; $i < count($photos); $i++) {
$image = $this->db->select('path')->where('id', $photos[$i])->get('photos')->row();
$strHtml .= "<img width='20' height='20' src='" . base_url() . $image->path . "'>";
}
} else {
$image = $this->db->select('path')->where('id', $objItem['photo_id'])->get('photos')->row();
$strHtml .= "<img width='20' height='20' src='" . base_url() . $image->path . "'>";
}
}
}
} else {
$strHtml .= $objItem[$arrReportField['strFieldReference']];
}
if (array_key_exists('arrFooter', $arrReportField) && array_key_exists('booTotal', $arrReportField['arrFooter'])) {
if (array_key_exists($arrReportField['strFieldReference'], $arrTotals)) {
$arrTotals[$arrReportField['strFieldReference']] += $objItem[$arrReportField['strFieldReference']];
} else {
$arrTotals[$arrReportField['strFieldReference']] = $objItem[$arrReportField['strFieldReference']];
}
}
$strHtml .= "</td>";
}
$strHtml .= "</tr>";
}
$strHtml .= "</tbody>";
$strHtml .= "<tfoot><tr>";
foreach ($arrFields as $arrReportField) {
if (array_key_exists('arrFooter', $arrReportField)) {
if (array_key_exists('booTotal', $arrReportField['arrFooter']) && $arrReportField['arrFooter']['booTotal']) {
$strHtml .= "<td>";
if (array_key_exists('strConversion', $arrReportField) && ($arrReportField['strConversion'] == "price")) {
$strHtml .= $currency;
}
$strHtml .= $arrTotals[$arrReportField['strFieldReference']];
$strHtml .= "</td>";
} else {
if (array_key_exists('booTotalLabel', $arrReportField['arrFooter']) && $arrReportField['arrFooter']['booTotalLabel']) {
$strHtml .= "<td";
if (array_key_exists('intColSpan', $arrReportField['arrFooter']) && ($arrReportField['arrFooter']['intColSpan'] > 0)) {
$strHtml .= " colspan=\"" . $arrReportField['arrFooter']['intColSpan'] . "\"";
}
$strHtml .= " class=\"right\">";
$strHtml .= "Totals</td>";
}
}
}
}
$strHtml .= "</tr></tfoot>";
$strHtml .= "</table>";
$strHtml .= "<p>Produced by " . $arrPageData['arrSessionData']["objSystemUser"]->firstname . " " . $arrPageData['arrSessionData']["objSystemUser"]->lastname . " (" . $arrPageData['arrSessionData']["objSystemUser"]->username . ") on " . date('d/m/Y') . "</p>";
$strHtml .= "</div></body></html>";
if (!$booOutputHtml) {
$this->load->library('Mpdf');
$mpdf = new Pdf('en-GB', 'A4');
$mpdf->setFooter('{PAGENO} of {nb}');
$mpdf->WriteHTML($strHtml);
$mpdf->Output("YouAudit_" . date('Ymd_His') . ".pdf", "D");
} else {
echo $strHtml;
die();
}
}
示例3: outputPdfFileComplianceComplete
public function outputPdfFileComplianceComplete($strReportName, $arrResults, $booOutputHtml = false)
{
$strHtml = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"https://www.iworkaudit.com/includes/css/report.css\" /></head>";
$strHtml .= "<body><div>";
$strHtml .= "<table><tr><td>";
$strHtml .= "<h1>Youaudit Report</h1>";
$strHtml .= "<h2>" . $strReportName . "</h2>";
$strHtml .= "</td><td class=\"right\">";
$logo = 'logo.png';
$strHtml .= "<img alt=\"Youaudit\" src='brochure/logo/" . $logo . "'>";
$strHtml .= "</td></tr></table>";
$strHtml .= "<table class=\"report\">";
$strHtml .= "<thead>";
$strHtml .= "<tr>";
$strHtml .= "<th>Date</th>";
$strHtml .= "<th>QR Code</th>";
$strHtml .= "<th>Serial No</th>";
$strHtml .= "<th>Manufacturer & Model</th>";
$strHtml .= "<th>Category</th>";
$strHtml .= "<th>Check Name</th>";
$strHtml .= "<th>Mandatory</th>";
$strHtml .= "</tr>";
$strHtml .= "</thead><tbody>";
foreach ($arrResults as $test) {
$strHtml .= "<tr>";
$date_ex = explode('-', $test['test_date']);
$test['test_date'] = $date_ex[2] . "-" . $date_ex[1] . "-" . $date_ex[0];
$strHtml .= "<td>" . $test['test_date'] . "</td>";
$strHtml .= "<td><a href=\"/iwa/items/view/" . $test['test_item_id'] . "\">" . $test['barcode'] . "</a></td>";
$strHtml .= "<td>" . $test['serial_number'] . "</td>";
$strHtml .= "<td>" . $test['manufacturer'] . " " . $test['model'] . "</td>";
$strHtml .= "<td>" . $test['name'] . "</td>";
$strHtml .= "<td>" . $test['test_type_name'] . "</td>";
if ($test['test_type_mandatory'] == 1) {
$strHtml .= "<td>Yes</td>";
} else {
$strHtml .= "<td>No</td>";
}
$strHtml .= "</tr>";
}
$strHtml .= "</tbody>";
$strHtml .= "<tfoot><tr>";
$strHtml .= "</table>";
$strHtml .= "<p>Produced by " . $this->session->userdata('objSystemUser')->firstname . " " . $this->session->userdata('objSystemUser')->lastname . " (" . $this->session->userdata('objSystemUser')->username . ") on " . date('d/m/Y') . "</p>";
$strHtml .= "</div></body></html>";
if (!$booOutputHtml) {
$this->load->library('Mpdf');
$mpdf = new Pdf('en-GB', 'A4');
$mpdf->setFooter('{PAGENO} of {nb}');
$mpdf->WriteHTML($strHtml);
$mpdf->Output("iwareport_" . date('Ymd_His') . ".pdf", "D");
} else {
echo $strHtml;
die;
}
}
示例4: mailroutine
function mailroutine($customer_data)
{
$new_file = $_SERVER['DOCUMENT_ROOT'] . '/iwa/excel_file/isareport_' . date('Ymd_His') . '.pdf';
$curr_count = (int) $this->count_routine;
$total_count = count($customer_data);
if ($total_count > $curr_count) {
if ((int) $customer_data[$this->count_routine]['account_id'] > 0) {
$table = $this->getDues($customer_data[$this->count_routine]['account_id'], $customer_data[$this->count_routine]['id']);
$this->load->library('Mpdf');
$mpdf = new Pdf('en-GB', 'A4');
$mpdf->setFooter('{PAGENO} of {nb}');
$mpdf->WriteHTML($table);
$mpdf->Output($new_file, "F");
$this->load->library('email');
$this->email->from("tickets@iworkaudit.com", "Due Compliance");
// $this->email->to('dharmendra@ignisitsolutions.com');
$this->email->to($customer_data[$this->count_routine]['username']);
$this->email->subject('Due Compliance List');
$this->email->message('Due Compliance list is attached with pdf (Testing) ');
$this->email->attach($new_file);
$this->email->send();
$this->count_routine = $this->count_routine + 1;
$this->email->clear(TRUE);
$this->mailroutine($customer_data);
} else {
$this->count_routine = $this->count_routine + 1;
$this->mailroutine($customer_data);
}
}
}
示例5: outputPdfFile
//.........这里部分代码省略.........
if (!empty($manu)) {
foreach ($manu as $man) {
if ($man == '') {
$strHtml .= "N/A";
$strHtml .= "<br>";
} else {
$strHtml .= $man;
$strHtml .= "<br>";
}
}
} else {
$strHtml .= "N/A";
}
break;
case 'manufacturer':
$manufacturer = json_decode($objItem['manufacturer']);
if (!empty($manufacturer)) {
foreach ($manufacturer as $manufact) {
if ($manufact == '') {
$strHtml .= "N/A";
$strHtml .= "<br>";
} else {
$strHtml .= $manufact;
$strHtml .= "<br>";
}
}
} else {
$strHtml .= "N/A";
}
break;
}
} else {
$strHtml .= $objItem[$arrReportField['strFieldReference']];
}
if (array_key_exists('arrFooter', $arrReportField) && array_key_exists('booTotal', $arrReportField['arrFooter'])) {
if (array_key_exists($arrReportField['strFieldReference'], $arrTotals)) {
$arrTotals[$arrReportField['strFieldReference']] += $objItem[$arrReportField['strFieldReference']];
} else {
$arrTotals[$arrReportField['strFieldReference']] = $objItem[$arrReportField['strFieldReference']];
}
}
$strHtml .= "</td>";
}
$strHtml .= "</tr>";
}
$strHtml .= "</tbody>";
$strHtml .= "<tfoot><tr>";
foreach ($arrFields as $arrReportField) {
if (array_key_exists('arrFooter', $arrReportField)) {
if (array_key_exists('booTotal', $arrReportField['arrFooter']) && $arrReportField['arrFooter']['booTotal']) {
$strHtml .= "<td>";
if (array_key_exists('strConversion', $arrReportField) && ($arrReportField['strConversion'] == "price")) {
$strHtml .= $currency;
}
$strHtml .= $arrTotals[$arrReportField['strFieldReference']];
$strHtml .= "</td>";
} else {
if (array_key_exists('booTotalLabel', $arrReportField['arrFooter']) && $arrReportField['arrFooter']['booTotalLabel']) {
$strHtml .= "<td";
if (array_key_exists('intColSpan', $arrReportField['arrFooter']) && ($arrReportField['arrFooter']['intColSpan'] > 0)) {
$strHtml .= " colspan=\"" . $arrReportField['arrFooter']['intColSpan'] . "\"";
}
$strHtml .= " class=\"right\">";
$strHtml .= "Totals</td>";
}
}
}
}
$strHtml .= "</tr></tfoot>";
$strHtml .= "</table>";
if (($arrPageData['arrSessionData']["objAdminUser"])) {
$strHtml .= "<p>Produced by " . $arrPageData['arrSessionData']["objAdminUser"]->firstname . " " . $arrPageData['arrSessionData']["objAdminUser"]->lastname . " (" . $arrPageData['arrSessionData']["objAdminUser"]->username . ") on " . date('d/m/Y') . "</p>";
$strHtml .= "</div></body></html>";
} else {
$strHtml .= "<p>Produced by " . $arrPageData['arrSessionData']['YouAuditSystemAdmin']['firstname'] . " " . $arrPageData['arrSessionData']['YouAuditSystemAdmin']['lastname'] . " (" . $arrPageData['arrSessionData']['YouAuditSystemAdmin']['username'] . ") on " . date('d/m/Y') . "</p>";
$strHtml .= "</div></body></html>";
}
if (!$booOutputHtml) {
$this->load->library('Mpdf');
$mpdf = new Pdf('en-GB', 'A4');
$mpdf->setFooter('{PAGENO} of {nb}');
$mpdf->WriteHTML($strHtml);
$mpdf->Output("YouAudit_" . date('Ymd_His') . ".pdf", "D");
} else {
echo $strHtml;
die();
}
}
示例6: exportPdfFile
public function exportPdfFile($allData, $filename = "isareport") {
$this->load->model('accounts_model');
$booOutputHtml = false;
$data['allData'] = $allData;
$data['title'] = $filename;
// $data['accountDetails'] = $this->accounts_model->getOne($this->session->userdata('objSystemUser')->accountid);
$strHtml = $this->load->view('items/exporttopdf', $data, true);
// echo $strHtml;die;
if (!$booOutputHtml) {
$this->load->library('Mpdf');
$mpdf = new Pdf('en-GB', 'A4');
$mpdf->setHeader($filename);
$mpdf->setFooter('{PAGENO} of {nb}');
$mpdf->WriteHTML($strHtml);
$mpdf->Output("$filename.pdf", "D");
} else {
echo $strHtml;
die();
}
}
示例7: getPdfForOpenJob
//.........这里部分代码省略.........
$strHtml .= "<thead>";
$strHtml .= "<tr style='background-color:#00AEEF;color:white;'>";
$strHtml .= "<th style='padding:10px;'>QR Code</th><th>Manufacturer</th><th>Model</th><th>Category</th><th>Item</th><th>Location</th><th>Site</th><th>Owner</th><th>Severity</th><th>Order No</th><th>Fault Logged By</th>";
$strHtml .= "</tr>";
$strHtml .= "</thead><tbody>";
$strHtml .= "<tr>";
$strHtml .= "<td style='padding:10px;'>" . $fullItemsData[0]->barcode . "</td><td>" . $fullItemsData[0]->manufacturer . "</td><td>" . $fullItemsData[0]->model . "</td><td>" . $fullItemsData[0]->categoryname . "</td><td>" . $fullItemsData[0]->item_manu_name . "</td><td>" . $fullItemsData[0]->locationname . "</td><td>" . $fullItemsData[0]->sitename . "</td><td>" . $fullItemsData[0]->userfirstname . " " . $fullItemsData[0]->userlastname . "</td><td>" . $fullItemsData[0]->severity . "</td><td>" . $fullItemsData[0]->order_no . "</td><td>" . $fullItemsData[0]->loggedBy . "</td>";
$strHtml .= "</tr>";
$strHtml .= "</tbody></table>";
//#############################################################
// safety check data
$strHtml .= "<div> </div>";
$strHtml .= "<table class=\"report\">";
$strHtml .= "<thead>";
$strHtml .= "<tr style='background-color:#00AEEF;color:white;'>";
if ($fullItemsData[0]->test_compliance_name != '') {
$safetyCheck = '< ' . $fullItemsData[0]->test_compliance_name . ' >';
} else {
$safetyCheck = '< SAFETY CHECKS DUE >';
}
$strHtml .= "<th style='padding:10px;width:800px;'>Safety Check " . $safetyCheck . "</th>";
$strHtml .= "</tr>";
$strHtml .= "</thead><tbody>";
foreach ($previousHistory as $safetyData) {
$strHtml .= "<tr>";
$strHtml .= "<td style='padding:5px;'>" . $safetyData['fault_type'] . "</td><td>" . $safetyData['severity'] . "</td>";
$strHtml .= "</tr>";
}
$strHtml .= "</tbody></table>";
//#############################################################
$strHtml .= "<div> </div>";
$strHtml .= "<div> </div>";
$strHtml .= "<div><h1 style='color:#00aeef;'>Incident Timeline</h1></div>";
$strHtml .= "<table class=\"report\">";
$strHtml .= "<thead>";
$strHtml .= "<tr style='background-color:#00AEEF;color:white;'>";
$strHtml .= "<th style='padding:10px;'>Date</th><th>Time</th><th>Event</th><th>Logged By</th><th>Code</th><th>Notes</th>";
$strHtml .= "</tr>";
$strHtml .= "</thead><tbody>";
foreach ($all_job_notes as $val) {
$strHtml .= "<tr>";
$strHtml .= "<td style='padding:10px;'>" . date('Y/m/d', strtotime($val['date'])) . "</td><td>" . date('h:i:s', strtotime($val['date'])) . "</td><td>" . $val['action'] . "</td><td>" . $val['firstname'] . " " . $val['lastname'] . "</td>";
$strHtml .= "<td>";
if ($val['fix_code'] != "") {
$strHtml .= $val['fix_code'];
} else {
$strHtml .= $val['reason_code'];
}
$strHtml .= "</td>";
$strHtml .= "<td>" . $val['jobnote'] . "</td>";
$strHtml .= "</tr>";
}
$strHtml .= "</tbody></table>";
//#############################################
$strHtml .= "<div><h1 style='color:#00aeef;'>Photo Images</h1></div>";
//##############################################
$strHtml .= "<table class=\"report\">";
$strHtml .= "<tbody>";
$strHtml .= "<tr>";
$photoIds = explode(",", $fullItemsData[0]->photoid);
$strHtml .= "<td style='padding:10px;'><div style='width:1000px;height:200px;'>";
foreach ($photoIds as $photo_id) {
$faultPhoto = $this->getPhotoPath($photo_id);
$strHtml .= "<img style='margin-left:7px;' width='300' height='200' alt=\"ictracker\" src='" . base_url($faultPhoto) . "'>";
}
$strHtml .= "</div></td></tr>";
$strHtml .= "</tbody></table>";
//#############################################
$strHtml .= "<div> </div>";
$strHtml .= "<div> </div>";
$strHtml .= "<div><h1 style='color:#00aeef;'>History - Previous Faults</h1></div>";
//##############################################
$strHtml .= "<table class=\"report\">";
$strHtml .= "<thead>";
$strHtml .= "<tr style='background-color:#00AEEF;color:white;'>";
$strHtml .= "<th style='padding:10px;'>Date</th><th>Time</th><th>Type Of Fault</th><th>Code</th><th>Logged By</th><th>Fix Time</th>";
$strHtml .= "</tr>";
$strHtml .= "</thead><tbody>";
foreach ($previousHistory as $val1) {
$date2 = date('d-m-Y', strtotime($val1['fix_date']));
$date1 = date('d-m-Y H:i:s', strtotime($val1['date']));
$diff = abs(strtotime($date2) - strtotime($date1));
$days = floor($diff / 3600 / 24);
$months = floor(($diff - $years * 365 * 60 * 60 * 24) / (30 * 60 * 60 * 24));
$total_time = $months . ' month ' . $days . ' days ';
$strHtml .= "<tr>";
$strHtml .= "<td style='padding:10px;'>" . date('Y/m/d', strtotime($val1['date'])) . "</td><td>" . date('h:i:s', strtotime($val1['date'])) . "</td><td>" . $val1['fault_type'] . "</td><td>" . $val1['fix_code'] . "</td><td>" . $val['firstname'] . " " . $val['lastname'] . "</td><td>" . $total_time . "</td>";
$strHtml .= "<td>";
$strHtml .= "</tr>";
}
$strHtml .= "</tbody></table>";
//#############################################
$strHtml .= "</body></html>";
// echo $strHtml;die;
$this->load->library('Mpdf');
$mpdf = new Pdf('en-GB', 'A4');
// $mpdf->setFooter('{PAGENO} of {nb}');
$mpdf->WriteHTML($strHtml);
$mpdf->Output("YouAudit_" . date('Ymd_His') . ".pdf", "D");
}
示例8: outputPdfFile
//.........这里部分代码省略.........
$strHtml .= "</tr>";
$strHtml .= "</thead><tbody>";
$arrTotals = array();
foreach ($arrResults as $objItem) {
$strHtml .= "<tr>";
foreach ($arrFields as $arrReportField) {
$strHtml .= "<td style='height:50px'>";
if (array_key_exists('strConversion', $arrReportField)) {
switch ($arrReportField['strConversion']) {
case 'date':
$arrDate = explode('-', $objItem->{$arrReportField['strFieldReference']});
if (count($arrDate) > 1) {
$strHtml .= $arrDate[2] . "/" . $arrDate[1] . "/" . $arrDate[0];
} else {
$strHtml .= "Unknown";
}
break;
case 'datetime':
$arrDateTime = explode(' ', $objItem->{$arrReportField['strFieldReference']});
$strTime = $arrDateTime[1];
$arrDate = explode('-', $arrDateTime[0]);
$strHtml .= $arrDate[2] . "/" . $arrDate[1] . "/" . $arrDate[0] . " " . $strTime;
break;
case 'owner':
if ($objItem['owner'] == 1) {
$strHtml.="Yes";
} else {
$strHtml.="No";
}
break;
case 'price':
$strHtml .= $currency . $objItem->{$arrReportField['strFieldReference']};
break;
}
} else {
$strHtml .= $objItem[$arrReportField['strFieldReference']];
}
if (array_key_exists('arrFooter', $arrReportField) && array_key_exists('booTotal', $arrReportField['arrFooter'])) {
if (array_key_exists($arrReportField['strFieldReference'], $arrTotals)) {
$arrTotals[$arrReportField['strFieldReference']] += $objItem[$arrReportField['strFieldReference']];
} else {
$arrTotals[$arrReportField['strFieldReference']] = $objItem[$arrReportField['strFieldReference']];
}
}
$strHtml .= "</td>";
}
$strHtml .= "</tr>";
}
$strHtml .= "</tbody>";
$strHtml .= "<tfoot><tr>";
foreach ($arrFields as $arrReportField) {
if (array_key_exists('arrFooter', $arrReportField)) {
if (array_key_exists('booTotal', $arrReportField['arrFooter']) && $arrReportField['arrFooter']['booTotal']) {
$strHtml .= "<td>";
if (array_key_exists('strConversion', $arrReportField) && ($arrReportField['strConversion'] == "price")) {
$strHtml .= $currency;
}
$strHtml .= $arrTotals[$arrReportField['strFieldReference']];
$strHtml .= "</td>";
} else {
if (array_key_exists('booTotalLabel', $arrReportField['arrFooter']) && $arrReportField['arrFooter']['booTotalLabel']) {
$strHtml .= "<td";
if (array_key_exists('intColSpan', $arrReportField['arrFooter']) && ($arrReportField['arrFooter']['intColSpan'] > 0)) {
$strHtml .= " colspan=\"" . $arrReportField['arrFooter']['intColSpan'] . "\"";
}
$strHtml .= " class=\"right\">";
$strHtml .= "Totals</td>";
}
}
}
}
$strHtml .= "</tr></tfoot>";
$strHtml .= "</table>";
$strHtml .= "<p>Produced by " . $this->session->userdata('objSystemUser')->firstname . " " . $this->session->userdata('objSystemUser')->lastname . " (" . $this->session->userdata('objSystemUser')->username . ") on " . date('d/m/Y') . "</p>";
$strHtml .= "</div></body></html>";
if (!$booOutputHtml) {
$this->load->library('Mpdf');
$mpdf = new Pdf('en-GB', 'A4');
$mpdf->setFooter('{PAGENO} of {nb}');
$mpdf->WriteHTML($strHtml);
$mpdf->Output("YouAudit_" . date('Ymd_His') . ".pdf", "D");
} else {
echo $strHtml;
die();
}
}