当前位置: 首页>>代码示例>>PHP>>正文


PHP pdf::Line方法代码示例

本文整理汇总了PHP中pdf::Line方法的典型用法代码示例。如果您正苦于以下问题:PHP pdf::Line方法的具体用法?PHP pdf::Line怎么用?PHP pdf::Line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pdf的用法示例。


在下文中一共展示了pdf::Line方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * Handles rendering the element on the pdf.
  *
  * @param pdf $pdf the pdf object
  * @param bool $preview true if it is a preview, false otherwise
  */
 public function render($pdf, $preview)
 {
     $colour = TCPDF_COLORS::convertHTMLColorToDec($this->element->colour, $colour);
     $pdf->SetLineStyle(array('width' => $this->element->data, 'color' => $colour));
     $pdf->Line(0, 0, $pdf->getPageWidth(), 0);
     $pdf->Line($pdf->getPageWidth(), 0, $pdf->getPageWidth(), $pdf->getPageHeight());
     $pdf->Line(0, $pdf->getPageHeight(), $pdf->getPageWidth(), $pdf->getPageHeight());
     $pdf->Line(0, 0, 0, $pdf->getPageHeight());
 }
开发者ID:rezaies,项目名称:moodle-mod_customcert,代码行数:15,代码来源:lib.php

示例2:

 $pdf->CreateTextBox($user->email, 0, 60, 80, 10, 10);
 $pdf->CreateTextBox($user->phone, 0, 65, 80, 10, 10);
 //$pdf->CreateTextBox('Zip, city name', 0, 70, 80, 10, 10);
 // invoice title / number
 $pdf->CreateTextBox('Factura #' . $booking->id, 0, 90, 120, 20, 16);
 // date, order ref
 $date = date_create($booking->date_booking);
 $pdf->CreateTextBox('Fecha: ' . date_format($date, "d/m/Y H:i:s"), 0, 100, 0, 10, 10, '', 'R');
 $pdf->CreateTextBox('Order ref.: #' . $booking->id, 0, 105, 0, 10, 10, '', 'R');
 // ROWS
 // list headers
 $pdf->CreateTextBox('Dias', 0, 120, 20, 10, 10, 'B', 'C');
 $pdf->CreateTextBox('Habitacion', 20, 120, 90, 10, 10, 'B');
 $pdf->CreateTextBox('Precio', 110, 120, 30, 10, 10, 'B', 'R');
 $pdf->CreateTextBox('Total', 140, 120, 30, 10, 10, 'B', 'R');
 $pdf->Line(20, 129, 195, 129);
 $currY = 128;
 $pdf->CreateTextBox($booking->getDays(), 0, $currY, 20, 10, 10, '', 'C');
 $pdf->CreateTextBox($room->name, 20, $currY, 90, 10, 10, '');
 $pdf->CreateTextBox('€' . $room->price, 110, $currY, 30, 10, 10, '', 'R');
 $pdf->CreateTextBox('€' . $booking->getTotal(), 140, $currY, 30, 10, 10, '', 'R');
 $currY = $currY + 5;
 $pdf->Line(20, $currY + 4, 195, $currY + 4);
 // FOOTER
 // output the total row
 $pdf->CreateTextBox('Total', 20, $currY + 5, 135, 10, 10, 'B', 'R');
 $pdf->CreateTextBox('€' . number_format($booking->getTotal(), 2, '.', ''), 140, $currY + 5, 30, 10, 10, 'B', 'R');
 // some payment instructions or information
 $pdf->setXY(20, $currY + 30);
 $pdf->SetFont(PDF_FONT_NAME_MAIN, '', 10);
 $pdf->MultiCell(175, 10, '<em>Lorem ipsum dolor sit amet, consectetur adipiscing elit</em>.
开发者ID:erseco,项目名称:ugr_sistemas_de_informacion_basados_en_web,代码行数:31,代码来源:pdf.php

示例3: customcert_generate_grid_pdf

/**
 * Generate the grid PDF to show the layout of the PDF.
 *
 * @param int $pageid the customcert page
 */
function customcert_generate_grid_pdf($pageid)
{
    global $CFG, $DB;
    require_once $CFG->libdir . '/pdflib.php';
    // Get the page.
    $page = $DB->get_record('customcert_pages', array('id' => $pageid), '*', MUST_EXIST);
    // Set the PDF name.
    $pdfname = get_string('gridpdfname', 'customcert', $page->id);
    // Create the pdf object.
    $pdf = new pdf();
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);
    $pdf->SetTitle($pdfname);
    $pdf->SetMargins(0, 0);
    $pdf->SetAutoPageBreak(true, 0);
    // Add the page to the PDF.
    if ($page->width > $page->height) {
        $orientation = 'L';
    } else {
        $orientation = 'P';
    }
    $pdf->AddPage($orientation, array($page->width, $page->height));
    // The cell width.
    $cellwidth = 10;
    $cellheight = 10;
    // The increments we want to go up in.
    $inc = 20;
    $decpos = 4;
    // Draw first lines before we increment from here.
    $pdf->Line($inc / 2 + 2, 0, $inc / 2 + 2, $page->height);
    $pdf->Line(0, $inc / 2, $page->width, $inc / 2);
    // Now we want to start drawing the lines to make the grid.
    // Draw the horizontal lines.
    for ($h = $inc; $h <= $page->height; $h += $inc) {
        // Dirty hack cause the printer keeps cutting off characters
        // near the end of the page for some BS reason.
        if (strlen($h) <= 2) {
            $lmargin = 5;
        } else {
            $lmargin = 4;
        }
        // Write the distance we are at.
        $pdf->writeHTMLCell($cellwidth, $cellheight, $lmargin, $h - $decpos, $h);
        // Get the location we are going to draw the line and then draw it.
        $hline = $h + $inc / 2;
        $pdf->Line(0, $hline, $page->width, $hline);
    }
    // Draw the vertical lines.
    for ($w = $inc; $w <= $page->width; $w += $inc) {
        // Write the distance we are at.
        $pdf->writeHTMLCell($cellwidth, $cellheight, $w - $decpos, 3, $w);
        // Get the location we are going to draw the line and then draw it.
        $wline = $w + $inc / 2;
        $pdf->Line($wline, 0, $wline, $page->height);
    }
    // Draw the margin line.
    if (!empty($page->margin)) {
        $pdf->Line($page->width - $page->margin, 0, $page->width - $page->margin, $page->height, array('dash' => '2'));
    }
    $pdf->Output($pdfname . '.pdf', 'D');
    exit;
}
开发者ID:rezaies,项目名称:moodle-mod_customcert,代码行数:67,代码来源:locallib.php

示例4: array

$userid = optional_param ('userid', 0, PARAM_INT);
$prgid = optional_param ('prgid', 0, PARAM_INT);
$year = optional_param ('year', 0, PARAM_INT);
ob_clean() ;
require_once($CFG->dirroot.'/lib/pdflib.php');

$doc = new pdf;
$doc->setPrintHeader(false);
$doc->setPrintFooter(false);
$doc->AddPage();
$doc->SetFont('times', 'B', 25, '', 'false');
$gradst = $DB->get_record('local_graduation', array('userid'=>$userid, 'curriculumid'=>$curid, 'programid'=>$prgid));
$txt = $DB->get_field('local_school', 'fullname', array('id'=>$gradst->schoolid));
$doc->Write(0, $txt, '', 0, 'C', true, 0, false, false, 20);
$linestyle = array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2', 'phase' => 0, 'color' => array(0, 0, 0));
$doc->Line(10, 22, 200, 22, $linestyle);
$doc->SetFont('times', 'BI', 14, '', 'false');
$txt = get_string('memo', 'local_graduation');
$doc->Write(12, $txt, '', 0, 'C', true, 0, false, false, 20);
$linestyle = array('width' => 0.1, 'cap' => 'round', 'join' => 'round', 'dash' => '2', 'phase' => 0, 'color' => array(0, 0, 0));
$doc->Line(80, 30, 130, 30, $linestyle);
$doc->SetFont('times', '', 12, '', 'false');
$gradst = $DB->get_record('local_graduation', array('userid'=>$userid, 'curriculumid'=>$curid, 'programid'=>$prgid));
$gradst->userid;$gradst->programid;$gradst->curriculumid;
$table = '<table>
<tr><td style="width:100px;" align="right"><b>Student Name</b></td><td style="width:170px;"> : ' .''.$DB->get_field('user', 'firstname', array('id'=>$gradst->userid)). ' ' . $DB->get_field('user', 'lastname', array('id'=>$gradst->userid)) . '</td>
<td align="right"><b>'.get_string('studentid', 'local_graduation').'</b></td><td> : ' .''.$DB->get_field('local_userdata', 'serviceid', array('userid'=>$gradst->userid)).'</td></tr>
<tr><td align="right"><b>'.get_string('program', 'local_programs').'</b></td><td> : ' .''.$DB->get_field('local_program', 'fullname', array('id'=>$gradst->programid)).'</td>
<td align="right"><b>'.get_string('curriculum', 'local_curriculum').'</b></td><td> : ' .''.$DB->get_field('local_curriculum', 'fullname', array('id'=>$gradst->curriculumid)).'</td></tr>
<tr><td align="right"><b>'.get_string('primaryyear', 'local_admission').'</b></td><td> : ' .''.$gradst->year .'</td>
<td align="right"><b>'.get_string('final_cgpa', 'local_graduation').'</b></td><td> : ' .''.$gradst->finalcgpa .'</td></tr>
开发者ID:anilch,项目名称:Personel,代码行数:31,代码来源:memo_pdf.php


注:本文中的pdf::Line方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。