本文整理汇总了PHP中pdf::getPageWidth方法的典型用法代码示例。如果您正苦于以下问题:PHP pdf::getPageWidth方法的具体用法?PHP pdf::getPageWidth怎么用?PHP pdf::getPageWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pdf
的用法示例。
在下文中一共展示了pdf::getPageWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例2: certificate_output_entity_completion
/**
* Refactored code from @see certificate_output_completion()
* an array of parameters is passed and used by the certificate
* template file. It is up to the certificate template file to
* use whatever parameters are available
*
* @param array $params: An array of parameters (example: array('student_name' => 'some value'))
* Here are a list of values that can be used
* 'student_name', 'course_name', 'class_idnumber', 'class_enrol_time', 'class_enddate', 'class_grade',
* 'cert_timeissued', 'cert_code', 'class_instructor_name', 'course_description_name'
* (there will most likely be more when other entity types are added)
* @param string $border: A custom border image to use
* @param string $seal: A custom seal image to use
* @param string $template: A custom template to use
* @return string - pdf output
*/
function certificate_output_entity_completion($params, $border = '', $seal = '', $template = '')
{
global $CFG;
// Use the TCPDF library.
require_once $CFG->libdir . '/pdflib.php';
// Global settings.
$borders = 0;
$font = 'FreeSerif';
$largefontsize = 30;
$smallfontsize = 16;
// Create pdf.
$pdf = new pdf('L', 'in', 'Letter');
// Prevent the pdf from printing black bars.
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetAutoPageBreak(false);
$pdf->SetMargins(0, 0, 0, false);
$pdf->AddPage();
$pagewidth = $pdf->getPageWidth();
$pageheight = $pdf->getPageHeight();
// Draw the border.
cm_certificate_check_data_path('borders');
if (!empty($border)) {
if (file_exists($CFG->dirroot . '/local/elisprogram/pix/certificate/borders/' . $border)) {
$pdf->Image($CFG->dirroot . '/local/elisprogram/pix/certificate/borders/' . $border, 0, 0, $pagewidth, $pageheight);
} else {
if (file_exists($CFG->dataroot . '/local/elisprogram/pix/certificate/borders/' . $border)) {
$pdf->Image($CFG->dataroot . '/local/elisprogram/pix/certificate/borders/' . $border, 0, 0, $pagewidth, $pageheight);
}
}
}
// Draw the seal.
cm_certificate_check_data_path('seals');
if (!empty($seal)) {
if (file_exists($CFG->dirroot . '/local/elisprogram/pix/certificate/seals/' . $seal)) {
$pdf->Image($CFG->dirroot . '/local/elisprogram/pix/certificate/seals/' . $seal, 8.0, 5.8);
} else {
if (file_exists($CFG->dataroot . '/local/elisprogram/pix/certificate/seals/' . $seal)) {
$pdf->Image($CFG->dataroot . '/local/elisprogram/pix/certificate/seals/' . $seal, 8.0, 5.8);
}
}
}
// Include the certificate template.
cm_certificate_check_data_path('templates');
if (file_exists($CFG->dirroot . '/local/elisprogram/pix/certificate/templates/' . $template)) {
include $CFG->dirroot . '/local/elisprogram/pix/certificate/templates/' . $template;
} else {
if (file_exists($CFG->dataroot . '/local/elisprogram/pix/certificate/templates/' . $template)) {
include $CFG->dataroot . '/local/elisprogram/pix/certificate/templates/' . $template;
}
}
$pdf->Output();
}