本文整理匯總了PHP中TCPDF::getY方法的典型用法代碼示例。如果您正苦於以下問題:PHP TCPDF::getY方法的具體用法?PHP TCPDF::getY怎麽用?PHP TCPDF::getY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TCPDF
的用法示例。
在下文中一共展示了TCPDF::getY方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Rotate
private function Rotate($type, $x = -1, $y = -1)
{
if ($type == "") {
$angle = 0;
} elseif ($type == "Left") {
$angle = 90;
} elseif ($type == "Right") {
$angle = 270;
} elseif ($type == "UpsideDown") {
$angle = 180;
}
if ($x == -1) {
$x = $this->pdf->getX();
}
if ($y == -1) {
$y = $this->pdf->getY();
}
if ($this->angle != 0) {
$this->pdf->_out('Q');
}
$this->angle = $angle;
if ($angle != 0) {
$angle *= M_PI / 180;
$c = cos($angle);
$s = sin($angle);
$cx = $x * $this->pdf->k;
$cy = ($this->pdf->h - $y) * $this->pdf->k;
$this->pdf->_out(sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm', $c, $s, -$s, $c, $cx, $cy, -$cx, -$cy));
}
}
示例2: testPdfOutput
public function testPdfOutput()
{
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 007');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 007', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
$pdf->setLanguageArray($this->langSettings);
// ---------------------------------------------------------
// set font
$pdf->SetFont('times', '', 12);
// add a page
$pdf->AddPage();
// create columns content
$left_column = '<b>LEFT COLUMN</b> left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column';
$right_column = '<b>RIGHT COLUMN</b> right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column';
// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true)
// get current vertical position
$y = $pdf->getY();
// set color for background
$pdf->SetFillColor(255, 255, 200);
// set color for text
$pdf->SetTextColor(0, 63, 127);
// write the first column
$pdf->writeHTMLCell(80, '', '', $y, $left_column, 1, 0, 1, true, 'J', true);
// set color for background
$pdf->SetFillColor(215, 235, 255);
// set color for text
$pdf->SetTextColor(127, 31, 0);
// write the second column
$pdf->writeHTMLCell(80, '', '', '', $right_column, 1, 1, 1, true, 'J', true);
// reset pointer to the last page
$pdf->lastPage();
$this->comparePdfs($pdf);
}
示例3: setPosition
/**
* set the New position for the current Tag
*
* @access public
*/
public function setPosition()
{
// get the current position
$currentX = $this->_pdf->getX();
$currentY = $this->_pdf->getY();
// save it
$this->value['xc'] = $currentX;
$this->value['yc'] = $currentY;
if ($this->value['position'] == 'relative' || $this->value['position'] == 'absolute') {
if ($this->value['right'] !== null) {
$x = $this->getLastWidth(true) - $this->value['right'] - $this->value['width'];
if ($this->value['margin']['r']) {
$x -= $this->value['margin']['r'];
}
} else {
$x = $this->value['left'];
if ($this->value['margin']['l']) {
$x += $this->value['margin']['l'];
}
}
if ($this->value['bottom'] !== null) {
$y = $this->getLastHeight(true) - $this->value['bottom'] - $this->value['height'];
if ($this->value['margin']['b']) {
$y -= $this->value['margin']['b'];
}
} else {
$y = $this->value['top'];
if ($this->value['margin']['t']) {
$y += $this->value['margin']['t'];
}
}
if ($this->value['position'] == 'relative') {
$this->value['x'] = $currentX + $x;
$this->value['y'] = $currentY + $y;
} else {
$this->value['x'] = $this->_getLastAbsoluteX() + $x;
$this->value['y'] = $this->_getLastAbsoluteY() + $y;
}
} else {
$this->value['x'] = $currentX;
$this->value['y'] = $currentY;
if ($this->value['margin']['l']) {
$this->value['x'] += $this->value['margin']['l'];
}
if ($this->value['margin']['t']) {
$this->value['y'] += $this->value['margin']['t'];
}
}
// save the new position
$this->_pdf->setXY($this->value['x'], $this->value['y']);
}
示例4: render
public function render(\TCPDF $pdf, $width = null)
{
$image = $this->_obj->getContent();
$imgSize = getimagesize(Core::$basePath . $image);
$height = $pdf->pixelsToUnits($imgSize[1]);
$width = $pdf->pixelsToUnits($imgSize[0]);
$pdf->setJPEGQuality(75);
if ($this->_obj->getParameter('pos_x') || $this->_obj->getParameter('pos_y')) {
$currentY = $pdf->getY();
$currentAPB = $pdf->getAutoPageBreak();
$currentMB = $pdf->getMargins();
$currentMB = $currentMB['bottom'];
$pdf->setAutoPageBreak(false, 0);
$pdf->write('');
}
$pdf->Image(Core::$basePath . $image, $this->_obj->getParameter('pos_x') ? $pdf->pixelsToUnits($this->_obj->getParameter('pos_x')) : null, $this->_obj->getParameter('pos_y') ? $pdf->pixelsToUnits($this->_obj->getParameter('pos_y')) : null, $width * $this->_obj->getParameter('ratio'), $height * $this->_obj->getParameter('ratio'), null, $this->_obj->getParameter('link'), 'N');
if (isset($currentY)) {
$pdf->setY($currentY);
$pdf->setAutoPageBreak($currentAPB, $currentMB);
}
}
示例5:
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
//initialize document
$pdf->AliasNbPages();
// add a page
$pdf->AddPage();
// ---------------------------------------------------------
// set font
$pdf->SetFont("times", "", 12);
// create columns content
$left_column = "<b>left column</b> left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column";
$right_column = "<b>right column</b> right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column";
// set columns width
$first_column_width = 80;
$second_column_width = 80;
// get current vertical position
$current_y_position = $pdf->getY();
// write the first column
$pdf->writeHTMLCell($first_column_width, 0, 0, $current_y_position, $left_column, 1, 0, 0, true);
// write the second column
$pdf->writeHTMLCell($second_column_width, 0, 0, 0, $right_column, 1, 1, 0, true);
// reset pointer to the last page
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output("example_007.pdf", "I");
//============================================================+
// END OF FILE
//============================================================+
示例6:
// set font
$pdf->SetFont('times', '', 14);
// add a page
$pdf->AddPage();
// create columns content
$left_column = '<b>LEFT COLUMN</b> left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column';
$right_column = '<b>RIGHT COLUMN</b> right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column';
// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true)
// get current vertical position
$y = $pdf->getY();
// set color for background
$pdf->SetFillColor(255, 255, 200);
// set color for text
$pdf->SetTextColor(0, 63, 127);
// write the first column
$pdf->writeHTMLCell(80, '', '', $y, $left_column, 1, 0, 1, true, 'J', true);
// set color for background
$pdf->SetFillColor(215, 235, 255);
// set color for text
$pdf->SetTextColor(127, 31, 0);
示例7: loanPaperWorkPDF
//.........這裏部分代碼省略.........
if (strstr($this->LoanAgents, ' and ')) {
$c = 'comply';
} else {
$c = 'complies';
}
$paragraphs[] = <<<EOD
Please ensure that {$this->LoanAgents} {$c} with the enclosed loan conditions.
EOD;
$paragraphs[] = <<<EOD
Electronic data for the specimens in this loan is available on request. For queries relating
to loans, exchange or donations, please email MEL at herbmel@rbg.vic.gov.au.
EOD;
foreach ($paragraphs as $para) {
$pdf->Multicell(125, 5, $para, 0, 'J', 0, 1, 25, $pdf->GetY() + 1, true, false, true);
}
$pdf->MultiCell(125, 5, $this->loaninfo['ShippedBy'] . ' on behalf of the Collections Manager', 0, 'L', 0, 1, 25, $pdf->GetY() + 8, true, false, true);
$y = 231;
//$image_file = base_url() . 'images/scissors.png';
//$pdf->Image($image_file, 22, $y-2.5, 5, 5, 'PNG', '', 'T', false, 300, '', false, false, 0, false, false, false);
//$pdf->MultiCell(127, 5, '<hr/>', 0, 'L', 0, 1, 25.5, $y, true, false, true);
$pdf->MultiCell(130, 5, '<hr/>', 0, 'L', 0, 1, 22.5, $y, true, false, true);
$y = $pdf->GetY() - 1;
$pdf->MultiCell(45, 5, 'Number of parcels: ' . $this->loaninfo['NumberOfPackages'], 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(75, 5, 'Number of specimens: ' . $this->Quantity(), 0, 'L', 0, 1, 75, $y, true, false, true);
$pdf->MultiCell(125, 5, 'Material received in good condition.', 0, 'L', 0, 1, 25, $pdf->GetY() + 3, true, false, true);
$y = $pdf->GetY() + 3;
$pdf->MultiCell(25, 5, 'Comments: ', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(105, 5, '<hr/>', 0, 'L', 0, 1, 45, $y + 4, true, false, true);
$pdf->MultiCell(125, 5, '<hr/>', 0, 'L', 0, 1, 25, $pdf->GetY() + 1, true, false, true);
$pdf->MultiCell(125, 5, '<hr/>', 0, 'L', 0, 1, 25, $pdf->GetY() + 1, true, false, true);
$y = $pdf->GetY() + 1;
$pdf->MultiCell(35, 5, 'Receiving officer:', 0, 'L', 0, 1, 25, $y, true, false, true);
$pdf->MultiCell(60, 5, '<hr/>', 0, 'L', 0, 1, 53, $y + 4, true, false, true);
$pdf->MultiCell(15, 5, 'Date: ', 0, 'L', 0, 1, 115, $y, true, false, true);
$pdf->MultiCell(25, 5, '<hr/>', 0, 'L', 0, 1, 125, $y + 4, true, false, true);
$pdf->setY(0);
$x = 165;
$pdf->SetFont('helvetica', '', 7);
$letterh = <<<EOD
<div style="color:#999999">National Herbarium of Victoria (MEL)<br />Birdwood Avenue<br />
South Yarra<br />
Victoria 3141<br />
Australia
</div>
EOD;
$pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, 60, true, false, true);
$letterh = <<<EOD
<div style="color:#999999">CITES<br />AU 026</div>
EOD;
$pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
$letterh = <<<EOD
<div style="color:#999999">Telephone<br />(03) 9252 2300</div>
EOD;
$pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
$letterh = <<<EOD
<div style="color:#999999">Facsimile<br />(03) 9252 2413</div>
EOD;
$pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
$letterh = <<<EOD
<div style="color:#999999">Email<br />herbmel@rbg.vic.gov.au</div>
EOD;
$pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
$letterh = <<<EOD
<div style="color:#999999">Web<br/ >www.rbg.vic.gov.au/science</div>
EOD;
$pdf->MultiCell(31, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
$letterh = <<<EOD
<div style="color:#999999">The Royal Botanic Gardens Board (Victoria)</div>
EOD;
$pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 111, true, false, true);
$letterh = <<<EOD
<div style="color:#999999">Patron<br />Dame Elisabeth Murdoch</div>
EOD;
$pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
$letterh = <<<EOD
<div style="color:#999999">Incorporating:</div>
EOD;
$pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 5, true, false, true);
$letterh = <<<EOD
<div style="color:#999999">Royal Botanic Gardens Melbourne</div>
EOD;
$pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
$letterh = <<<EOD
<div style="color:#999999">National Herbarium of Victoria</div>
EOD;
$pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
$letterh = <<<EOD
<div style="color:#999999">Royal Botanic Gardens Cranbourne</div>
EOD;
$pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
$letterh = <<<EOD
<div style="color:#999999">Australian Research Centre for Urban Ecology</div>
EOD;
$pdf->MultiCell(30, 5, $letterh, 0, 'L', 0, 1, $x, $pdf->getY() + 1, true, false, true);
// move pointer to last page
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('loan.pdf', 'I');
}
示例8: writeDetalles
function writeDetalles(DataSource $dataSource, TCPDF $pdf, $tipo)
{
$blackAll = array('LTRB' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$widthMarginLeft = 1;
$width1 = 20;
$width2 = 85;
$pdf->Ln();
$pdf->SetFontSize(7.5);
$pdf->SetFont('', 'B');
$height = 5;
$pdf->SetFillColor(255, 255, 255, true);
$pdf->setTextColor(0, 0, 0);
if ($tipo == 'adjudicado') {
$pdf->Cell($width2 - $width1 * 2, $height, 'Item', $blackAll, 0, 'l', true, '', 1, false, 'T', 'C');
} else {
$pdf->Cell($width2, $height, 'Item', $blackAll, 0, 'l', true, '', 1, false, 'T', 'C');
}
$pdf->Cell($width1, $height, 'Cantidad Ref.', $blackAll, 0, 'L', true, '', 1, false, 'T', 'C');
if ($tipo != 'borrador') {
$pdf->Cell($width1, $height, 'Precio Unitario Ref.', $blackAll, 0, 'C', true, '', 1, false, 'T', 'C');
}
$pdf->Cell($width1, $height, 'Cantidad Ofert.', $blackAll, 0, 'L', true, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, 'Precio Unitario Ofert.', $blackAll, 0, 'C', true, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, 'Total Ofert.', $blackAll, 0, 'C', true, '', 1, false, 'T', 'C');
if ($tipo == 'adjudicado') {
$pdf->Cell($width1, $height, 'Cantidad Adj.', $blackAll, 0, 'l', true, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, 'Total', $blackAll, 0, 'l', true, '', 1, false, 'T', 'C');
}
$pdf->Ln();
$pdf->SetFontSize(6.5);
foreach ($dataSource->getDataset() as $row) {
$pdf->SetFont('', '');
$xAntesMultiCell = $pdf->getX();
$yAntesMultiCell = $pdf->getY();
//$totalItem
if ($tipo == 'borrador') {
$pdf->MultiCell($width2, $height, $row['desc_solicitud_det'] . "\r\n" . ' - ' . $row['descripcion_sol'], 1, 'L', false, 1);
$yDespuesMultiCell = $pdf->getY();
$height = $yDespuesMultiCell - $yAntesMultiCell;
$pdf->setXY($xAntesMultiCell + $width2, $yAntesMultiCell);
$pdf->Cell($width1, $height, $row['cantidad_sol'], 1, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, '', 1, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, '', 1, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, '', 1, 0, 'R', false, '', 1, false, 'T', 'C');
} else {
if ($tipo == 'cotizado') {
$pdf->MultiCell($width2, $height, $row['desc_solicitud_det'] . "\r\n" . ' - ' . $row['descripcion_sol'], 1, 'L', false, 1);
$yDespuesMultiCell = $pdf->getY();
$height = $yDespuesMultiCell - $yAntesMultiCell;
$pdf->setXY($xAntesMultiCell + $width2, $yAntesMultiCell);
$pdf->Cell($width1, $height, $row['cantidad_sol'], 1, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, number_format($row['precio_unitario_sol'], 2), 1, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, $row['cantidad_coti'], 1, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, number_format($row['precio_unitario'], 2), 1, 0, 'R', false, '', 1, false, 'T', 'C');
$totalItem = number_format($row['cantidad_coti'] * $row['precio_unitario'], 2);
$pdf->Cell($width1, $height, $totalItem, 1, 0, 'R', false, '', 1, false, 'T', 'C');
} else {
$pdf->MultiCell($width2 - $width1 * 2, $height, $row['desc_solicitud_det'] . "\r\n" . ' - ' . $row['descripcion_sol'], 1, 'L', false, 1);
$yDespuesMultiCell = $pdf->getY();
$height = $yDespuesMultiCell - $yAntesMultiCell;
$pdf->setXY($xAntesMultiCell + $width2 - $width1 * 2, $yAntesMultiCell);
$pdf->Cell($width1, $height, $row['cantidad_sol'], 1, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, number_format($row['precio_unitario_sol'], 2), 1, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, $row['cantidad_coti'], 1, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, number_format($row['precio_unitario'], 2), 1, 0, 'R', false, '', 1, false, 'T', 'C');
$totalItem = number_format($row['cantidad_coti'] * $row['precio_unitario'], 2);
$pdf->Cell($width1, $height, $totalItem, 1, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, $row['cantidad_adju'], 1, 0, 'R', false, '', 1, false, 'T', 'C');
$totalAdj = number_format($row['cantidad_adju'] * $row['precio_unitario'], 2);
$pdf->Cell($width1, $height, $totalAdj, 1, 0, 'R', false, '', 1, false, 'T', 'C');
}
}
$pdf->Ln();
}
}
示例9: writeDetalles
function writeDetalles(DataSource $dataSource, TCPDF $pdf)
{
$blackAll = array('LTRB' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$blackSide = array('LR' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$blackBottom = array('B' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$blackTop = array('T' => array('width' => 0.3, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$widthMarginLeft = 1;
$width1 = 15;
$width2 = 25;
$width3 = 20;
$pdf->SetFontSize(7.5);
$pdf->SetFont('', 'B');
$height = 5;
$pdf->Ln();
foreach ($dataSource->getDataset() as $row) {
$pdf->setFont('', 'B');
$pdf->Cell($width2, $height, 'Código Partida', 0, 0, 'L', false, '', 0, false, 'T', 'C');
$pdf->Cell($width2, $height, 'Nombre Partida', 0, 0, 'L', false, '', 0, false, 'T', 'C');
$pdf->Cell($width2 * 3 + 10, $height, 'Centro de Costo', 0, 0, 'L', false, '', 0, false, 'T', 'C');
$pdf->Cell($width2, $height, '', 0, 0, 'R', false, '', 0, false, 'T', 'C');
$pdf->Cell($width2, $height, 'Disponibilidad', 0, 0, 'R', false, '', 0, false, 'T', 'C');
$pdf->Ln();
$pdf->setFont('', '');
$pdf->Cell($width2, $height, $row['groupeddata'][0]['codigo_partida'], 0, 0, 'L', false, '', 0, false, 'T', 'C');
$pdf->Cell($width2, $height, $row['groupeddata'][0]['nombre_partida'], 0, 0, 'L', false, '', 1, false, 'T', 'C');
$pdf->Cell($width2 * 3 + 10, $height, $row['groupeddata'][0]['desc_centro_costo'], 0, 0, 'L', false, '', 1, false, 'T', 'C');
$xRef = $pdf->getX();
$yRef = $pdf->getY();
$pdf->Cell($width2, $height, $row['totalRef'], 0, 0, 'R', false, '', 0, false, 'T', 'C');
if ($row['disponible'] == true) {
$pdf->setTextColor(0, 0, 0);
$pdf->Cell($width2, $height, 'DISPONIBLE', 0, 0, 'R', false, '', 0, false, 'T', 'C');
} else {
$pdf->setTextColor(255, 0, 0);
$pdf->Cell($width2, $height, 'NO DISPONIBLE', 0, 0, 'R', false, '', 0, false, 'T', 'C');
}
$pdf->setTextColor(0, 0, 0);
//$pdf->Cell($width2, $height, ($row['disponible']==true)?'DISPONIBLE':'NO DISPONIBLE', 0, 0, 'R', false, '', 0, false, 'T', 'C');
$pdf->Ln();
$pdf->setFont('', 'B');
$pdf->Cell($width2 + $width1, $height, 'Concepto Gasto', $blackAll, 0, 'L', false, '', 1, false, 'T', 'C');
$pdf->Cell($width2 + 25, $height, 'Descripcion', $blackAll, 0, 'L', false, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, 'Cantidad', $blackAll, 0, 'L', false, '', 1, false, 'T', 'C');
$pdf->Cell($width3, $height, 'Precio Unitario', $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width3, $height, 'Precio Total', $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width3, $height, 'Precio Ges. Act.', $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width3, $height, 'Precio Ges. Sig.', $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Ln();
$totalRef = 0;
$totalGa = 0;
$totalSg = 0;
$xEnd = 0;
$yEnd = 0;
foreach ($row['groupeddata'] as $solicitudDetalle) {
$pdf->setFont('', '');
$pdf->Cell($width2 + $width1, $height, $solicitudDetalle['desc_concepto_ingas'], $blackSide, 0, 'L', false, '', 1, false, 'T', 'C');
$pdf->Cell($width2 + 25, $height, $solicitudDetalle['descripcion'], $blackSide, 0, 'L', false, '', 1, false, 'T', 'C');
$pdf->Cell($width1, $height, $solicitudDetalle['cantidad'], $blackSide, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width3, $height, number_format($solicitudDetalle['precio_unitario'], 2), $blackSide, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width3, $height, number_format($solicitudDetalle['precio_total'], 2), $blackSide, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width3, $height, number_format($solicitudDetalle['precio_ga'], 2), $blackSide, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width3, $height, number_format($solicitudDetalle['precio_sg'], 2), $blackSide, 0, 'R', false, '', 1, false, 'T', 'C');
$totalRef = $totalRef + $solicitudDetalle['precio_total'];
$totalGa = $totalGa + $solicitudDetalle['precio_ga'];
$totalSg = $totalSg + $solicitudDetalle['precio_sg'];
$pdf->Ln();
$xEnd = $pdf->getX();
$yEnd = $pdf->getY();
}
//$pdf->setXY($xRef,$yRef);
//$pdf->Cell($width2, $height, $totalRef, 0, 0, 'R', false, '', 0, false, 'T', 'C');
$pdf->setXY($xEnd, $yEnd);
$pdf->Cell(185, $height, '', $blackTop, 1, 'L', false, '', 0, false, 'T', 'C');
$pdf->setXY($xEnd, $yEnd);
$pdf->Cell($width1 * 2 + $width2 * 2 + $width3 + 25, $height, '', '0', 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width3, $height, number_format($totalRef, 2), $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width3, $height, number_format($totalGa, 2), $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Cell($width3, $height, number_format($totalSg, 2), $blackAll, 0, 'R', false, '', 1, false, 'T', 'C');
$pdf->Ln($height * 2);
}
}
示例10: printLabel
function printLabel($labeldata, $props, $start = 0)
{
$numx = $props['numx'];
$numy = $props['numy'];
$labelheight = $props['dimensions']['labelheight'];
$labelwidht = $props['dimensions']['labelwidth'];
$labelheader_pos = $props['dimensions']['labelheader_pos'];
$barcode_pos = $props['dimensions']['barcode_pos'];
$barcodetext_pos = $props['dimensions']['barcodetext_pos'];
$labelbody_pos = $props['dimensions']['labelbody_pos'];
$labelfooter_pos = $props['dimensions']['labelfooter_pos'];
$numlabels = $numx * $numy;
if ($this->input->post('labeltype') == 6 || $this->input->post('labeltype') == 7 || $this->input->post('labeltype') == 13 || $this->input->post('labeltype') == 14) {
$dup = true;
} else {
$dup = false;
}
set_time_limit(600);
// create new PDF document
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Niels Klazenga');
$pdf->SetTitle('MEL Label');
$pdf->SetSubject('MEL Label');
//set margins
$pdf->SetMargins(5, 7.5, 5);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, 7.5);
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// ---------------------------------------------------------
// set font
$pdf->SetFont('times', '', 9);
// set cell padding
$pdf->setCellPaddings(0, 0, 0, 0);
// set cell margins
$pdf->setCellMargins(0, 0, 0, 0);
if (!$dup) {
$labelheader = '<p style="font-weight: bold"><span style="font-size: 11pt;">NATIONAL HERBARIUM OF VICTORIA (MEL)</span><br />
<span style="font-size: 11pt;">MELBOURNE, AUSTRALIA</span></p>';
} else {
$labelheader = '<p style="font-weight: bold"><span style="font-size: 30px;">Ex NATIONAL HERBARIUM OF VICTORIA (MEL)</span><br />
<span style="font-size: 11pt;">MELBOURNE, AUSTRALIA</span></p>';
}
$barcodestyle = array('position' => '', 'padding' => 0, 'align' => 'C', 'stretch' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => 'auto', 'vpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false);
if ($start > 0) {
$pdf->AddPage();
}
for ($i = 0; $i < count($labeldata); $i++) {
$j = $i + $start;
$offset = $j % ($numx * $numy);
$x = $offset % $numx;
$y = floor($offset / $numx);
if ($j % $numlabels == 0) {
$pdf->AddPage();
}
$pdf->MultiCell($props['wheader'], 7.5, $labelheader, 0, 'C', 0, 1, $labelheader_pos['x'][$x], $labelheader_pos['y'][$y], true, false, true);
if (!$dup) {
$pdf->write1DBarcode($labeldata[$i]['melnumber'], 'C39', $barcode_pos['x'][$x], $barcode_pos['y'][$y], 55, 12, 0.1, $barcodestyle, 'N');
$pdf->MultiCell(55, 5, '<b>' . $labeldata[$i]['melnumber'] . '</b>', 0, 'C', 0, 1, $barcodetext_pos['x'][$x], $barcodetext_pos['y'][$y], true, false, true);
}
$pdf->MultiCell($props['whtml'], 5, $labeldata[$i]['html'], 0, 'L', 0, 1, $labelbody_pos['x'][$x], $labelbody_pos['y'][$y], true, 0, true, true, 0, 'T', false);
if ($props['footerpositionabsolute']) {
if ($dup) {
$pdf->MultiCell(90, 5, $labeldata[$i]['footer'], 0, 'L', 0, 1, $labelfooter_pos['x'][$x], $labelfooter_pos['y'][$y], true, 0, true, true, 0, 'T', false);
$pdf->write1DBarcode($labeldata[$i]['melnumber'], 'C39', $barcode_pos['x'][$x], $barcode_pos['y'][$y], 55, 12, 0.1, $barcodestyle, 'N');
$pdf->MultiCell(55, 5, '<b>' . $labeldata[$i]['melnumber'] . '</b>', 0, 'C', 0, 1, $barcodetext_pos['x'][$x], $barcodetext_pos['y'][$y], true, false, true);
} else {
$pdf->MultiCell(90, 5, $labeldata[$i]['footer'], 0, 'L', 0, 1, $labelfooter_pos['x'][$x], $labelfooter_pos['y'][$y] - 10, true, 0, true, true, 0, 'T', false);
}
} else {
$y = $pdf->getY() + 5;
if ($dup) {
$pdf->write1DBarcode($labeldata[$i]['melnumber'], 'C39', $barcode_pos['x'][$x], $y, 55, 12, 0.1, $barcodestyle, 'N');
$pdf->MultiCell(55, 5, '<b>' . $labeldata[$i]['melnumber'] . '</b>', 0, 'C', 0, 1, $barcodetext_pos['x'][$x], $y + 11, true, false, true);
$pdf->MultiCell(90, 5, $labeldata[$i]['footer'], 0, 'L', 0, 1, $labelfooter_pos['x'][$x], $y + 8.5, true, 0, true, true, 0, 'T', false);
} else {
$pdf->MultiCell(90, 5, $labeldata[$i]['footer'], 0, 'L', 0, 1, $labelfooter_pos['x'][$x], $y, true, 0, true, true, 0, 'T', false);
}
}
}
// move pointer to last page
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('mellabel.pdf', 'I');
}
示例11: print_pdf_link
public function print_pdf_link($dept, $grade, $name, $score)
{
ob_start();
ob_get_flush();
ob_get_clean();
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->SetFont('msungstdlight', 'B', 23);
// add a page
$pdf->AddPage();
// output the HTML content
$x = $pdf->getX();
$y = $pdf->getY();
$pdf->SetFont('msungstdlight', 'B', 24);
/*
$dept = "體育";
$grp = "男子組";
$item = "100公尺";
$order_no = "第一名";
$score = "9.09秒";
*/
if (isset($grade) && $grade != "") {
$pdf->writeHTMLCell($w = 115, $h = 0, $x = '11', $y = '100', $dept, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'R', $autopadding = true);
$pdf->writeHTMLCell($w = 13, $h = 0, $x = '152', $y = '100', $grade, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'C', $autopadding = true);
$pdf->SetFont('msungstdlight', 'B', 20);
$pdf->writeHTMLCell($w = 70, $h = 0, $x = '94', $y = '205', $score, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
} else {
if (isset($name) && $name != "") {
$pdf->writeHTMLCell($w = 120, $h = 0, $x = '40', $y = '95', $dept, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'R', $autopadding = true);
$pdf->writeHTMLCell($w = 140, $h = 0, $x = '20', $y = '110', $name, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'R', $autopadding = true);
$pdf->SetFont('msungstdlight', 'B', 20);
$pdf->writeHTMLCell($w = 80, $h = 0, $x = '99', $y = '201', $score, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
} else {
if (isset($dept) && $dept != "") {
$pdf->writeHTMLCell($w = 120, $h = 0, $x = '40', $y = '98', $dept, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = 'R', $autopadding = true);
$pdf->SetFont('msungstdlight', 'B', 20);
$pdf->writeHTMLCell($w = 100, $h = 0, $x = '93', $y = '202', $score, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
}
}
}
/*
$pdf->writeHTMLCell($w=130, $h=0, $x='29', $y='91', $dept, $border=0, $ln=1, $fill=0, $reseth=true, $align='C', $autopadding=true);
$pdf->writeHTMLCell($w=100, $h=0, $x='82', $y='142', $grp, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
$pdf->writeHTMLCell($w=100, $h=0, $x='82', $y='155', $item, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
$pdf->writeHTMLCell($w=100, $h=0, $x='82', $y='168', $order_no, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
$pdf->writeHTMLCell($w=100, $h=0, $x='82', $y='181', $score, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
*/
$pdf->SetFillColor(255, 255, 200);
$pdf->SetTextColor(0, 63, 127);
// reset pointer to the last page
$pdf->lastPage();
$pdf->Output('/var/www/sports/67/admin/print_cert/print_cert.pdf', 'F');
$response = '/sports/67/admin/print_cert/print_cert.pdf';
return $response;
}