本文整理汇总了PHP中PDF::LoadData方法的典型用法代码示例。如果您正苦于以下问题:PHP PDF::LoadData方法的具体用法?PHP PDF::LoadData怎么用?PHP PDF::LoadData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDF
的用法示例。
在下文中一共展示了PDF::LoadData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$this->Ln();
//Restauración de colores y fuentes
$this->SetFillColor(224, 235, 255);
$this->SetTextColor(0);
$this->SetFont('');
//Datos
$fill = 0;
foreach ($data as $row) {
$this->Cell($w[0], 6, $row[0], 'LR', 0, 'L', $fill);
$this->Cell($w[1], 6, $row[1], 'LR', 0, 'L', $fill);
$this->Cell($w[2], 6, number_format($row[2]), 'LR', 0, 'R', $fill);
$this->Cell($w[3], 6, number_format($row[3]), 'LR', 0, 'R', $fill);
$this->Ln();
$fill = !$fill;
}
$this->Cell(array_sum($w), 0, '', 'T');
}
}
$pdf = new PDF();
//Títulos de las columnas
$header = array('País', 'Capital', 'Superficie (km2)', 'Pobl. (en miles)');
//Carga de datos
$data = $pdf->LoadData('paises.txt');
$pdf->SetFont('Arial', '', 14);
$pdf->AddPage();
$pdf->BasicTable($header, $data);
$pdf->AddPage();
$pdf->ImprovedTable($header, $data);
$pdf->AddPage();
$pdf->FancyTable($header, $data);
$pdf->Output();
示例2: PDF
$this->SetFont('', 'B', 4);
$this->Cell($w[8], 3, $row[15], 'LR');
$this->SetFont('', 'B', 6);
$this->Cell($w[9], 3, $row[16], 'LR');
$this->SetFont('', 'B', 6);
$this->Ln();
$fill = !$fill;
$count++;
}
// Closing line
$this->Cell(array_sum($w), 0, '', 'T');
}
}
$pdf = new PDF();
$pdf->AliasNbPages();
$file = $_GET['file'];
//echo $file;
$data = $pdf->LoadData($file);
//$data = $pdf->LoadData('APK10825.csv');
$pdf->dateFinder($data);
$pdf->Header();
$pdf->SetMargins(20, 30);
// Column headings
$header = array('Box', 'Last6', 'Dog Name', 'Odds', 'Best', 'Total starts', 'Rating', 'Trk+dist', 'Trainer', 'Comment');
// Data loading
$pdf->SetFont('Arial', '', 6);
//$pdf-> Image('bg-pdf.jpg', 0, 0, 0, 0);
$pdf->AddPage();
$pdf->FancyTable($header, $data, $pdf);
$pdf->Output();
// $pdf->Output('myFile.pdf', 'F'); save file to the same folder | other options I, D
示例3: array
$pdf->Ln(10);
//Added by Imon
$attendees = array();
$total_cost = 0.0;
$total_orig_cost = 0.0;
$total_amount_pd = 0.0;
foreach ($registration_ids as $reg_id) {
$sql = "select ea.registration_id, ed.event_name, ed.start_date, ed.event_identifier, ea.fname, ea.lname, ea.quantity, ea.orig_price, ea.final_price, ea.amount_pd from " . EVENTS_ATTENDEE_TABLE . " ea ";
//$sql .= " inner join " . EVENTS_ATTENDEE_COST_TABLE . " eac on ea.id = eac.attendee_id ";
$sql .= " inner join " . EVENTS_DETAIL_TABLE . " ed on ea.event_id = ed.id ";
$sql .= " where ea.registration_id = '" . $reg_id['registration_id'] . "' order by ed.event_name ";
$tmp_attendees = $wpdb->get_results($sql, ARRAY_A);
foreach ($tmp_attendees as $tmp_attendee) {
$sub_total = $tmp_attendee["final_price"] * $tmp_attendee["quantity"];
$orig_total = $tmp_attendee["orig_price"] * $tmp_attendee["quantity"];
$attendees[] = $pdf->LoadData(array(pdftext($tmp_attendee["event_name"] . "[" . date('m-d-Y', strtotime($tmp_attendee['start_date'])) . "]") . ' >> ' . pdftext(html_entity_decode($tmp_attendee["fname"], ENT_QUOTES, "UTF-8") . " " . html_entity_decode($tmp_attendee["lname"], ENT_QUOTES, "UTF-8")) . ';' . pdftext($tmp_attendee["quantity"]) . ';' . doubleval($tmp_attendee["final_price"]) . ';' . doubleval($sub_total)));
$total_cost += $sub_total;
$total_orig_cost += $orig_total;
$total_amount_pd += $tmp_attendee["amount_pd"];
$event_identifier = $tmp_attendee["event_identifier"];
}
}
$header = array(__('Event & Attendee', 'event_espresso'), __('Quantity', 'event_espresso'), __('Per Unit', 'event_espresso'), __('Sub total', 'event_espresso'));
$w = array(100, 25, 30, 30);
$alling = array('L', 'L', 'C', 'C', 'C');
$left = 100 + 25 + 30;
$right = 30;
$pdf->ImprovedTable($header, $attendees, $w, $alling);
$pdf->Ln();
//if ( $total_amount_pd != $total_cost ) {
$pdf->InvoiceTotals(__('Total:', 'event_espresso'), $total_cost, $left, $right);
示例4: foreach
$this->SetFillColor(224, 235, 255);
$this->SetTextColor(0);
$this->SetFont('');
//Data
$fill = false;
foreach ($data as $row) {
$this->Cell($w[0], 6, $row[0], 'LR', 0, 'L', $fill);
$this->Cell($w[1], 6, $row[1], 'LR', 0, 'L', $fill);
$this->Cell($w[2], 6, number_format($row[2]), 'LR', 0, 'R', $fill);
$this->Cell($w[3], 6, number_format($row[3]), 'LR', 0, 'R', $fill);
$this->Ln();
$fill = !$fill;
}
$this->Cell(array_sum($w), 0, '', 'T');
}
}
$pdf = new PDF();
//Column titles
$header = array('Country', 'Capital', 'Area (sq km)', 'Pop. (thousands)');
//Data loading
$data = $pdf->LoadData('chinese_data.txt');
//$pdf->AddUniCNShwFont('uni');
$pdf->AddUniGBFont('uni');
$pdf->SetFont('uni', '', 14);
$pdf->AddPage();
$pdf->BasicTable($header, $data);
$pdf->AddPage();
$pdf->ImprovedTable($header, $data);
$pdf->AddPage();
$pdf->FancyTable($header, $data);
$pdf->Output();
示例5: foreach
//Color and font restoration
$this->SetFillColor(224, 235, 255);
$this->SetTextColor(0);
$this->SetFont('');
//Data
$fill = false;
foreach ($data as $row) {
$this->Cell($w[0], 6, $row[0], 'LR', 0, 'L', $fill);
$this->Cell($w[1], 6, $row[1], 'LR', 0, 'L', $fill);
$this->Cell($w[2], 6, number_format($row[2]), 'LR', 0, 'R', $fill);
$this->Cell($w[3], 6, number_format($row[3]), 'LR', 0, 'R', $fill);
$this->Ln();
$fill = !$fill;
}
$this->Cell(array_sum($w), 0, '', 'T');
}
}
$pdf = new PDF();
//Column titles
$header = array('Country', 'Capital', 'Area (sq km)', 'Pop. (thousands)');
//Data loading
$data = $pdf->LoadData('table_data_demo.txt');
$pdf->AddFont('arialunicid0', '', 'arialunicid0.php');
$pdf->SetFont('arialunicid0', '', 14);
$pdf->AddPage();
$pdf->BasicTable($header, $data);
$pdf->AddPage();
$pdf->ImprovedTable($header, $data);
$pdf->AddPage();
$pdf->FancyTable($header, $data);
$pdf->Output();
示例6: fopen
$pdf->Cell(80, 8, $shipping->address2, 0, 1);
}
$pdf->Cell(80, 8, $shipping->city . ' ' . $shipping->state . ' ' . $shipping->zip, 0, 1);
$pdf->Ln(20);
if ($order_id != '' && $order_id != false) {
$pdf->Cell(60, 8, 'Order: MCH' . $order_id, 0, 0);
} else {
$pdf->Cell(60, 8, 'Order Number Not Available', 0, 0);
}
$pdf->Cell(60, 8, 'Date of order: ' . format::format_date($order->date_created), 0, 1);
$pdf->Cell(60, 8, 'Requested Delivery Date: ' . format::format_date($order->order_delivery_date), 0, 2);
$pdf->Ln(15);
$order_products = Basket::getBasketContentForOrder($id);
$order_subtotal = 0;
$shipping = $order->shipping_total;
//$tax = $order->tax;
$string = '';
foreach ($order_products as $product) {
$pr = Product::getProductById($product->product_id);
$order_subtotal += $product->subtotal;
$string .= $pr->name . ';' . $product->qty . ';' . $pr->price . ';' . $product->subtotal . "\r\n";
}
$myFile = '/tmp/file.txt';
$fh = fopen($myFile, 'w');
fwrite($fh, $string);
fclose($fh);
$data = $pdf->LoadData($myFile);
unlink($myFile);
$table_header = array('Quantity', 'Product');
$pdf->FancyTable($table_header, $data);
$pdf->Output();
示例7: foreach
$this->Ln();
// Color and font restoration
$this->SetFillColor(224, 235, 255);
$this->SetTextColor(0);
$this->SetFont('');
// Data
$fill = false;
foreach ($data as $row) {
$this->Cell($w[0], 6, $row[0], 'LR', 0, 'L', $fill);
$this->Cell($w[1], 6, $row[1], 'LR', 0, 'L', $fill);
$this->Ln();
$fill = !$fill;
}
// Closing line
$this->Cell(array_sum($w), 0, '', 'T');
}
}
$pdf = new PDF();
// Column headings
// Data loading
$data = $pdf->LoadData($f_name);
$pdf->SetFont('Arial', '', 14);
$pdf->AddPage();
$pdf->FancyTable($header, $data);
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=" . $filename);
$expiredate = time() + 30;
$expireheader = "Expires: " . gmdate("D, d M Y G:i:s", $expiredate) . " GMT";
header($expireheader);
$pdf->Output();
exit;
示例8: foreach
// Color and font restoration
$this->SetFillColor(224, 235, 255);
$this->SetTextColor(0);
$this->SetFont('');
// Data
$fill = false;
foreach ($data as $row) {
$this->Cell($w[0], 6, $row[0], 'LR', 0, 'L', $fill);
$this->Cell($w[1], 6, $row[1], 'LR', 0, 'L', $fill);
$this->Cell($w[2], 6, number_format($row[2]), 'LR', 0, 'R', $fill);
$this->Cell($w[3], 6, number_format($row[3]), 'LR', 0, 'R', $fill);
$this->Ln();
$fill = !$fill;
}
// Closing line
$this->Cell(array_sum($w), 0, '', 'T');
}
}
$pdf = new PDF();
// Column headings
$header = array('Country', 'Capital', 'Area (sq km)', 'Pop. (thousands)');
// Data loading
$data = $pdf->LoadData('countries.txt');
$pdf->SetFont('Arial', '', 14);
$pdf->AddPage();
$pdf->BasicTable($header, $data);
$pdf->AddPage();
$pdf->ImprovedTable($header, $data);
$pdf->AddPage();
$pdf->FancyTable($header, $data);
$pdf->Output();
示例9: array
$nu_espessura = '';
$data = array();
$nome_arquivo = "lista_" . date("dmY") . date("his");
if (isset($_GET['ad']) && isset($_GET['job'])) {
$co_pcp_ad = $_GET['ad'];
$no_pcp_ad = $_GET['job'];
$result = $_peca->getListaPi($co_pcp_ad);
while ($dados = mysql_fetch_array($result)) {
$data[] = $dados['CO_INT_PRODUTO'] . ';' . $dados['DS_PRODUTO'] . ';' . $dados['NO_COR'] . ';' . $dados['QTD_PECAS'] . ';' . $dados['NU_COMPRIMENTO'] . ';' . $dados['NU_LARGURA'] . ';' . $dados['NU_ESPESSURA'];
$nu_lote = $dados['NU_LOTE'];
$ds_cor = $dados['DS_COR'];
$nu_espessura = $dados['NU_ESPESSURA'];
}
$pdf = new PDF();
$header = array('SEQ.', utf8_decode('CÓD. INT'), 'COR', utf8_decode('DESCRIÇÃO'), 'QTD.', 'X', 'Y', 'Z');
$data = $pdf->LoadData($data);
$pdf->AddPage('L');
//$pdf->BasicTable($header,$data);
//$pdf->AddPage();
//$pdf->ImprovedTable($header,$data);
//$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 14);
$pdf->Write(0, "LISTA " . $nu_lote . " " . $ds_cor . "-" . $nu_espessura);
$pdf->SetX(260);
$pdf->Write(0, date("d/m/Y"));
$pdf->Ln(3);
$pdf->SetFont('Arial', '', 9);
$pdf->FancyTable($header, $data);
$pdf->Ln(3);
$pdf->Write(0, 'Job: ' . $no_pcp_ad);
$pdf->Output($nome_arquivo, 'I');
示例10: avg
/*order by users average lowest first*/
$pdf->Cell(0, 8, 'Users average Lowest first: ', 0, 1);
$query = $_DB->Query("SELECT a.name, c.self_content_id, avg( c.self_count ) AS average , count( self_count ) AS number_of_words\n\t\tFROM jos_porsche_student AS a\n\t\tJOIN jos_porsche_self AS b ON a.id = b.student_id\n\t\tJOIN jos_porsche_self_writing_task AS c ON b.id = c.self_content_id\n\t\tWHERE a.school_id = '{$school_id}'\n\t\tAND a.level_id = '{$level_id}'\n\t\tAND a.class_id = '{$class_id}'\n\t\tAND b.module_id = '{$module_id}'\n\t\tAND b.ability = '{$ability}'\n\t\tAND b.task = 'self_write'\n\t\tAND c.self_error > '0'\n\t\tGROUP BY (\n\t\tc.self_content_id\n\t\t)\n\t\tORDER BY avg( c.self_count ) ASC");
break;
default:
$dataDB['Result']['Data'][0]['Status'] = "parameters missing";
break;
}
//var_dump($query);
$count = $_DB->GetResultNumber($query);
//echo $count;
if ($count == 0) {
$dataDB['Result']['Data'][0]['Status'] = "No users exist";
} else {
for ($i = 0; $i < $count; $i++) {
$pdf->Cell(0, 10, 'Student Name: ' . $_DB->GetResultValue($query, $i, 'name'), 0, 1);
$data = $pdf->LoadData($_DB->GetResultValue($query, $i, 'name'));
switch ($task) {
case '0':
case '1':
$pdf->Cell(300, 10, 'Time Taken: ' . $_DB->GetResultValue($query, $i, 'time_taken'), 0, 1);
break;
case '2':
case '3':
$pdf->Cell(100, 10, 'Average:' . $_DB->GetResultValue($query, $i, 'average'), 0, 1);
$pdf->Cell(100, 10, 'No of Words: ' . $_DB->GetResultValue($query, $i, 'number_of_words'), 0, 1);
break;
}
}
}
$pdf->Output('Reports', 'D');
示例11: LoadData
function LoadData($cart)
{
$data = array();
foreach ($cart->items as $item) {
$tmp = array($item->amount, $item->size, $item->product->id, $item->product->name, iconv('UTF-8', 'windows-1252', $item->product->price), $this->formatPrice($this->unformatPrice($item->product->price) * $item->amount));
array_push($data, $tmp);
}
return $data;
}
}
// Instanciation of inherited class
$pdf = new PDF('P', 'mm', 'A4');
// Column headings
$header = array('Anzahl', 'Groesse', 'Artikelnr.', 'Bezeichnung', 'Einzelpreis', 'Gesamtpreis');
// Data loading
$data = $pdf->LoadData($cart);
$pdf->SetTitle('Rechnung');
$pdf->SetAuthor('Alma Mater Wear GbR');
$pdf->AddPage();
$pdf->SetMargins(20, 20, 20);
$pdf->SetFont('Arial', '', 8);
//Adressfeld Alma Mater Wear GbR
$pdf->SetXY(154, 70);
$pdf->SetFont('Arial', 'B', 8);
$pdf->Cell(80, 5, 'Alma Mater Wear GbR', '', 0, 'L', false);
$pdf->SetFont('Arial', '', 8);
$pdf->SetXY(154, 75);
$pdf->Cell(80, 5, iconv("UTF-8", "ISO-8859-1", 'Donnersbergerstraße 8'), '', 0, 'L', false);
$pdf->SetXY(154, 80);
$pdf->Cell(80, 5, iconv("UTF-8", "ISO-8859-1", '80624 München'), '', 0, 'L', false);
$pdf->SetXY(154, 85);
示例12: explode
$_SESSION[pdf_date] = $_POST[pdf_date];
$_SESSION[header_data] = $_POST[header_data];
$_SESSION[longest_values] = $_POST[longest_values];
$_SESSION[pdf_alignment] = $_POST[pdf_alignment];
$_SESSION[any_totals] = $_POST[any_totals];
$_SESSION[total_pdf_array] = $_POST[total_pdf_array];
$_SESSION[create_graph] = $_POST[create_graph];
$_SESSION[pdf_graph] = $_POST[graph_type];
$_SESSION[graph_data_type] = $_POST[graph_data_type];
$_SESSION[pdf_graph_values] = $_POST[pdf_graph_values];
$_SESSION[pdf_graph_title] = $_POST[pdf_graph_title];
$_SESSION[print_logo] = $_POST[print_logo];
$pdf->AddPage($_SESSION[pdf_layout]);
$pdf->AliasNbPages();
$pdf->SetFont('Arial', '', 8);
$data = $pdf->LoadData('EXPORT_REPORT.csv');
$pdf->ColorTable($header, $data);
if ($_SESSION[create_graph] == "yes") {
$_SESSION[no_header] = "yes";
$pdf->AddPage($_SESSION[pdf_layout]);
$pdf->AliasNbPages();
$pdf->SetFont('Arial', '', 8);
require "chart.php";
$data = explode(",", $pdf_graph_values);
if ($_SESSION[pdf_layout] == "P") {
$chart = new chart(535, 720);
} elseif ($_SESSION[pdf_layout] == "L") {
$chart = new chart(785, 485);
}
if ($_SESSION[pdf_graph_title] != "") {
$chart->set_title("{$_SESSION['pdf_graph_title']}");
示例13: pdftext
$pdf->Cell(50, 5, $attendee_email, 0, 1, 'L');
//Set attendee email
//Set attendee address
$attendee_address != '' ? $pdf->Cell(100, 5, $attendee_address, 0, 1, 'L') : '';
$pdf->Cell(100, 5, pdftext($attendee_city != '' ? $attendee_city : '') . ($attendee_state != '' ? ' ' . $attendee_state : ''), 0, 1, 'L');
$attendee_zip != '' ? $pdf->Cell(50, 5, $attendee_zip, 0, 1, 'L') : '';
$pdf->Ln(10);
//Added by Imon
$attendees = array();
$total_cost = 0.0;
foreach ($registration_ids as $reg_id) {
$sql = "select ea.registration_id, ed.event_name, ed.start_date, ed.event_identifier, ea.fname, ea.lname, eac.quantity, eac.cost from " . EVENTS_ATTENDEE_TABLE . " ea\n\t\t\t\tinner join " . EVENTS_ATTENDEE_COST_TABLE . " eac on ea.id = eac.attendee_id\n\t\t\t\tinner join " . EVENTS_DETAIL_TABLE . " ed on ea.event_id = ed.id\n\t\t\t\twhere ea.registration_id = '" . $reg_id['registration_id'] . "' order by ed.event_name ";
$tmp_attendees = $wpdb->get_results($sql, ARRAY_A);
foreach ($tmp_attendees as $tmp_attendee) {
$sub_total = $tmp_attendee["cost"] * $tmp_attendee["quantity"];
$attendees[] = $pdf->LoadData(array(pdftext($tmp_attendee["event_name"] . "[" . date('m-d-Y', strtotime($tmp_attendee['start_date'])) . "]") . ' >> ' . pdftext($tmp_attendee["fname"] . " " . $tmp_attendee["lname"]) . ';' . pdftext($tmp_attendee["quantity"]) . ';' . doubleval($tmp_attendee["cost"]) . ';' . doubleval($sub_total)));
$total_cost += $sub_total;
$event_identifier = $tmp_attendee["event_identifier"];
}
}
$header = array("Event & Attendee", "Quantity", "Per Unit", "Sub total");
$w = array(100, 25, 30, 30);
$alling = array('L', 'L', 'C', 'C', 'C');
$left = 100 + 25 + 30;
$right = 30;
$pdf->ImprovedTable($header, $attendees, $w, $alling);
$pdf->Ln();
if ($amount_pd != $total_cost) {
$pdf->InvoiceTotals("Total:", $total_cost, $left, $right);
$discount = $amount_pd - $total_cost;
if ($discount < 0) {
示例14: PDF
$this->Cell($w[7], 6, $row[0], 'LR', 0, 'L', $fill);
} else {
$this->Cell($w[0], 6, $row[0], 'LR', 0, 'L', $fill);
$this->Cell($w[1], 6, $row[0], 'LR', 0, 'L', $fill);
$this->Cell($w[2], 6, $row[0], 'LR', 0, 'L', $fill);
$this->Cell($w[3], 6, $row[0], 'LR', 0, 'L', $fill);
$this->Cell($w[4], 6, $row[0], 'LR', 0, 'L', $fill);
$this->Cell($w[5], 6, $row[0], 'LR', 0, 'L', $fill);
$this->Cell($w[6], 6, $row[0], 'LR', 0, 'L', $fill);
$this->Cell($w[7], 6, $row[0], 'LR', 0, 'L', $fill);
}
$this->Ln();
$fill = !$fill;
}
// Closing line
$this->Cell(array_sum($w), 0, '', 'T');
}
}
$pdf = new PDF();
// Column headings
$header = array('Bill-To', 'Ship-To/Ship-To Location', 'PO #', 'Order/Quote/Plant', 'Planned/Est. Arr Shipping', 'Status');
// Data loading
$data = $pdf->LoadData('data.txt');
$pdf->SetFont('Arial', '', 14);
$pdf->AddPage('L');
//$pdf->BasicTable($header,$data);
/*$pdf->AddPage();
$pdf->ImprovedTable($header,$data);
$pdf->AddPage();*/
$pdf->FancyTable($header, $data);
$pdf->Output();
示例15: fopen
if ($_POST['generate'] != '') {
$output = '';
$f = fopen($dir . $filecsv, 'w');
fputs($f, 'description;partnumber;qty' . "\n");
$data = $_POST['data'];
for ($i = 0; $i < count($data['qty']); $i++) {
if ($data['qty'][$i] > 0) {
fputs($f, '"' . $data['description'][$i] . '";"' . $data['partnumber'][$i] . '";' . $data['qty'][$i] . "\n");
}
}
if ($_POST['notiz'] != '') {
fputs($f, '"###' . $_POST['notiz'] . '"');
}
fclose($f);
$pdf = new PDF();
$data = $pdf->LoadData($dir . $filecsv);
$pdf->SetFont('Arial', '', 10);
$pdf->AddPage();
$pdf->SetTitle('Packliste ab ' . $datum);
$pdf->Titel('Packliste ab ' . $datum);
$pdf->SetDrawColor(255, 255, 255);
$pdf->BasicTable($data);
$pdf->Output($dir . $filepdf, "F");
if (file_exists($dir . $filepdf)) {
if ($_POST['weg'] == 2) {
$headers = array("From" => $_SESSION['email'], "X-Mailer" => "PHP/" . phpversion(), "Subject" => 'Packliste ab ' . $datum);
$mime = new Mail_Mime(array('eol' => "\n"));
$csv = $mime->addAttachment($dir . $filecsv, mime_content_type($dir . $filecsv), $filecsv);
$pdf = $mime->addAttachment($dir . $filepdf, mime_content_type($dir . $filepdf), $filepdf);
$mime->setTXTBody('Packliste');
$hdrs = $mime->headers($headers);