本文整理汇总了PHP中FPDI::image方法的典型用法代码示例。如果您正苦于以下问题:PHP FPDI::image方法的具体用法?PHP FPDI::image怎么用?PHP FPDI::image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPDI
的用法示例。
在下文中一共展示了FPDI::image方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FPDI
function front_id($results)
{
$this->load->helper('settings');
//print preview of MR
$this->load->library('fpdf');
$this->load->library('fpdi');
// initiate FPDI
$pdf = new FPDI('L');
// add a page
$pdf->AddPage();
// set the sourcefile
$pagecount = $pdf->setSourceFile('pdf-report/id/front-id.pdf');
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page and place it at point 10,10 with a width of 100 mm
$pdf->useTemplate($tplIdx);
//367
// now write some text above the imported page
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Arial', '', 9);
$n = 1;
foreach ($results as $result) {
$s = new Employee_m();
$row = $s->get_by_id($result->employee_id);
if ($n == 11) {
//add new page
$pdf->addPage();
for ($n = 1; $n <= 1; $n++) {
$tplidx = $pdf->ImportPage(1);
$pdf->useTemplate($tplIdx);
//, 1, 1, 210
}
$n = $n - 1;
}
//======================== START Column 1 ==============================
$pic = 'pics/not_available.png';
$photo = 'pics/' . $row->employee_id . '.png';
if (file_exists($photo)) {
$pic = 'pics/' . $row->employee_id . '.png';
}
//signature
$sign = 'pics/signatures/' . $row->employee_id . '.png';
$employee_id = $row->employee_id;
$name = utf8_decode($row->fname . ' ' . $row->lname);
$lblname = 'NAME';
$office = 'LAGUNA UNIVERSITY';
$position = $row->position;
$fs = '11.5';
if (strlen($name) >= 22) {
$fs = '9';
}
//----------------------------- Row 1 ----------------------------------
if ($n == 1) {
//Employee number
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Arial', 'B', 9);
$pdf->SetXY(18.5, 29);
$pdf->Cell(30, 0, 'EMP No. ' . $employee_id, '0', 0, 'C', false);
//Employee Photo 2x3
$pdf->image($pic, 17.5, 31, 32, 37);
//x, y, w, h
//Employee name
$pdf->SetFont('Arial', 'B', $fs);
$pdf->SetXY(18.5, 71);
$pdf->Cell(30, 0, strtoupper($name), '0', 0, 'C', false);
//label name
$pdf->SetFont('Arial', '', 5);
$pdf->SetXY(18.5, 74);
$pdf->Cell(30, 0, $lblname, '0', 0, 'C', false);
//Signature
if (file_exists($sign)) {
$pdf->image($sign, 20, 75, 25, 10);
//x, y, w, h
}
//label signature
$pdf->SetXY(18.5, 83);
$pdf->Cell(30, 0, 'SIGNATURE', '0', 0, 'C', false);
//Office
$pdf->SetTextColor(255, 255, 255);
//r, g ,b
$pdf->SetFont('Arial', 'B', 13);
$pdf->SetXY(18.5, 88);
$pdf->Cell(30, 0, $office, '0', 0, 'C', false);
//Position
$pdf->SetTextColor(255, 255, 0);
$pdf->SetFont('Arial', '', 10);
$pdf->SetXY(18.5, 94);
$pdf->Cell(30, 0, strtoupper($position), '0', 0, 'C', false);
}
//----------------------------- Row 2 ----------------------------------
if ($n == 2) {
//Employee number
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Arial', 'B', 9);
$pdf->SetXY(76.5, 29);
$pdf->Cell(30, 0, 'EMP No. ' . $employee_id, '0', 0, 'C', false);
//Employee Photo 2x3
$pdf->image($pic, 75.5, 31, 32, 37);
//x, y, w, h
//Employee name
//.........这里部分代码省略.........
示例2: generatesExternalReport
public function generatesExternalReport($id = -1)
{
/*
* Loading libraries and helpers
*/
$this->load->library(array('rb', 'fpdf_gen'));
$this->load->helper(array('date', 'utility'));
/*
* The request id is not set
*/
if ($id == -1) {
echo "Parece que não foi especificado qual o id da Solicitação.";
exit;
}
/*
* Loading request
*/
$request = R::findOne('request', 'id=?', array($id));
/*
* Request exists
*/
if ($request == null) {
echo 'Parece que a solicitação não existe.';
exit;
}
/*
* Creating PDF
*/
$pdf = new FPDI();
$pdf->addPage('L');
/* *********************************************************
* BEGIN - HEADER
********************************************************* */
$pdf->image(public_url('img/' . $this->config->item('system_report_logo')), 140, 5);
$pdf->ln(14);
$pdf->SetFont('Courier', 'B', 9);
$pdf->Cell(0, 0, utf8_decode($this->config->item('system_name')), 0, 0, 'C');
$pdf->Ln(5);
$pdf->SetFont('Courier', '', 9);
$pdf->Cell(0, 0, utf8_decode("SOLICITAÇÃO DE INFORMAÇÃO"), 0, 0, 'C');
/* *********************************************************
* END - HEADER
********************************************************* */
$pdf->Ln(10);
$pdf->SetFont('Courier', 'B', 9);
$pdf->SetDrawColor(217, 217, 217);
$pdf->SetFillColor(217, 217, 217);
$pdf->Cell(0, 10, utf8_decode(' DADOS DA SOLICITAÇÃO'), 'LRTB', 0, 'L', true);
$pdf->Ln(10);
$pdf->Cell(24, 10, utf8_decode(' PROTOCOLO: '), 'LTB', 0, 'L', false);
$pdf->SetFont('Courier', '', 9);
$pdf->Cell(110, 10, utf8_decode($request->protocol), 'TBR', 0, 'L', false);
$pdf->SetFont('Courier', 'B', 9);
$pdf->Cell(32, 10, utf8_decode(' SOLICITADA EM: '), 'TB', 0, 'L', false);
$pdf->SetFont('Courier', '', 9);
$pdf->Cell(111, 10, utf8_decode(mdate('%d/%m/%Y', strtotime($request->createdAt))), 'TBR', 0, 'L', false);
$pdf->Ln(10);
$pdf->SetFont('Courier', 'B', 9);
$pdf->Cell(24, 10, utf8_decode(' SITUAÇÃO: '), 'LB', 0, 'L', false);
$pdf->SetFont('Courier', '', 9);
$pdf->Cell(253, 10, utf8_decode(status_text($request->status)), 'TBR', 0, 'L', false);
$pdf->Ln(10);
$pdf->SetFont('Courier', 'B', 9);
$pdf->Cell(0, 10, utf8_decode(' SOLICITAÇÃO: '), 'LR', 0, 'L', false);
$pdf->Ln(8);
$pdf->SetFont('Courier', '', 9);
$pdf->MultiCell(0, 5, utf8_decode(' ' . $request->request), 'LR', 'L', false);
$pdf->Cell(0, 4, '', 'LR', 0, 'L', false);
$pdf->Ln(4);
$pdf->SetFont('Courier', 'B', 9);
$pdf->Cell(0, 10, utf8_decode(' TRÂMITAÇÃO'), 'LRTB', 0, 'L', true);
$pdf->Ln(10);
$pdf->SetFont('Courier', '', 9);
$statuses = R::find('status', ' request_id = ? ORDER BY created_at ASC ', array($request->id));
if (!count($statuses)) {
$pdf->Cell(0, 10, utf8_decode(' Nenhuma trâmitação ainda'), 'LRB', 0, 'L', false);
} else {
foreach ($statuses as $s) {
$pdf->SetFont('Courier', 'B', 9);
$pdf->Cell(0, 10, utf8_decode(' ' . status_text($s->type) . ' [' . date('d/m/Y', strtotime($s->createdAt)) . ']'), 'LR', 0, 'L', false);
$pdf->Ln(10);
$pdf->SetFont('Courier', '', 9);
$pdf->MultiCell(0, 5, utf8_decode(' ' . $s->response), 'LRB', 'L', false);
}
}
$pdf->Ln(10);
$pdf->Output();
}