本文整理汇总了PHP中TCPDF::GetY方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::GetY方法的具体用法?PHP TCPDF::GetY怎么用?PHP TCPDF::GetY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF
的用法示例。
在下文中一共展示了TCPDF::GetY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: if
/**
* Show miscellaneous information (payment mode, payment term, ...)
*
* @param TCPDF $pdf Object PDF
* @param Object $object Object to show
* @param int $posy Y
* @param Translate $outputlangs Langs object
* @return void
*/
function _tableau_info(&$pdf, $object, $posy, $outputlangs)
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1) {
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
$posy = $pdf->GetY() + 4;
}
$posxval = 52;
// Show payments conditions
if ($object->cond_reglement_code || $object->cond_reglement) {
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("PaymentConditions") . ':';
$pdf->MultiCell(80, 4, $titre, 0, 'L');
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_condition_paiement = $outputlangs->transnoentities("PaymentCondition" . $object->cond_reglement_code) != 'PaymentCondition' . $object->cond_reglement_code ? $outputlangs->transnoentities("PaymentCondition" . $object->cond_reglement_code) : $outputlangs->convToOutputCharset($object->cond_reglement_doc);
$lib_condition_paiement = str_replace('\\n', "\n", $lib_condition_paiement);
$pdf->MultiCell(80, 4, $lib_condition_paiement, 0, 'L');
$posy = $pdf->GetY() + 3;
}
// Check a payment mode is defined
/* Not used with orders
if (empty($object->mode_reglement_code)
&& ! $conf->global->FACTURE_CHQ_NUMBER
&& ! $conf->global->FACTURE_RIB_NUMBER)
{
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetTextColor(200,0,0);
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->MultiCell(80, 3, $outputlangs->transnoentities("ErrorNoPaiementModeConfigured"),0,'L',0);
$pdf->SetTextColor(0,0,0);
$posy=$pdf->GetY()+1;
}
*/
/* TODO
else if (! empty($object->availability_code))
{
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->SetTextColor(200,0,0);
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->MultiCell(80, 3, $outputlangs->transnoentities("AvailabilityPeriod").': '.,0,'L',0);
$pdf->SetTextColor(0,0,0);
$posy=$pdf->GetY()+1;
}*/
// Show planed date of delivery
if (!empty($object->date_livraison)) {
$outputlangs->load("sendings");
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("DateDeliveryPlanned") . ':';
$pdf->MultiCell(80, 4, $titre, 0, 'L');
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true);
$pdf->MultiCell(80, 4, $dlp, 0, 'L');
$posy = $pdf->GetY() + 1;
} elseif ($object->availability_code || $object->availability) {
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("AvailabilityPeriod") . ':';
$pdf->MultiCell(80, 4, $titre, 0, 'L');
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_availability = $outputlangs->transnoentities("AvailabilityType" . $object->availability_code) != 'AvailabilityType' . $object->availability_code ? $outputlangs->transnoentities("AvailabilityType" . $object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : '');
$lib_availability = str_replace('\\n', "\n", $lib_availability);
$pdf->MultiCell(80, 4, $lib_availability, 0, 'L');
$posy = $pdf->GetY() + 1;
}
// Show payment mode
if ($object->mode_reglement_code && $object->mode_reglement_code != 'CHQ' && $object->mode_reglement_code != 'VIR') {
$pdf->SetFont('', 'B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$titre = $outputlangs->transnoentities("PaymentMode") . ':';
$pdf->MultiCell(80, 5, $titre, 0, 'L');
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->SetXY($posxval, $posy);
$lib_mode_reg = $outputlangs->transnoentities("PaymentType" . $object->mode_reglement_code) != 'PaymentType' . $object->mode_reglement_code ? $outputlangs->transnoentities("PaymentType" . $object->mode_reglement_code) : $outputlangs->convToOutputCharset($object->mode_reglement);
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
$posy = $pdf->GetY() + 2;
}
// Show payment mode CHQ
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'CHQ') {
//.........这里部分代码省略.........
示例2: getPageRemainingHeight
protected function getPageRemainingHeight()
{
return $this->pdf->getPageHeight() - $this->pdf->GetY() - $this->pdf->getBreakMargin();
}
示例3: printAnnotationSlip
function printAnnotationSlip($labeldata, $props, $detnotes, $start = 0)
{
$numx = $props['numx'];
$numy = $props['numy'];
$labelheight = $props['dimensions']['labelheight'];
$labelwidht = $props['dimensions']['labelwidth'];
$labelheader_pos = $props['dimensions']['labelheader_pos'];
$labelbody_pos = $props['dimensions']['labelbody_pos'];
$numlabels = $numx * $numy;
set_time_limit(600);
$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, 3);
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// ---------------------------------------------------------
// set font
$pdf->SetFont('times', '', 8);
// set cell padding
$pdf->setCellPaddings(0, 0, 0, 0);
// set cell margins
$pdf->setCellMargins(0, 0, 0, 0);
$labelheader = '<p style="font-weight: bold"><span style="font-size:20px;">NATIONAL HERBARIUM OF VICTORIA (MEL)</span></p>';
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'], 1, $labelheader, 0, 'C', 0, 1, $labelheader_pos['x'][$x], $labelheader_pos['y'][$y], true, false, true);
$melno = '<p>MEL ';
$melno .= (int) substr($labeldata[$i]['CatalogNumber'], 0, 7) . substr($labeldata[$i]['CatalogNumber'], 7);
$melno .= '</p>';
$pdf->MultiCell($props['whtml'], 5, $melno, 0, 'L', 0, 1, $labelbody_pos['x'][$x], $labelbody_pos['y'][$y] - 1, true, 0, true, true, 0, 'T', false);
$pdf->MultiCell($props['whtml'], 5, $labeldata[$i]['FormattedName'], 0, 'C', 0, 1, $labelbody_pos['x'][$x], $pdf->GetY(), true, 0, true, true, 0, 'T', false);
if ($detnotes) {
$notes = '<p style="line-height:80%">' . $labeldata[$i]['DeterminationNotes'] . '</p>';
$pdf->MultiCell($props['whtml'], 5, $notes, 0, 'L', 0, 1, $labelbody_pos['x'][$x], $pdf->GetY(), true, 0, true, true, 0, 'T', false);
}
if (!$labeldata[$i]['Role']) {
$labeldata[$i]['Role'] = 'Det.';
}
if ($labeldata[$i]['Role'] == 'Acc. name change') {
$by = 'Accepted name change';
} else {
$by = $labeldata[$i]['Role'] . ' ' . $labeldata[$i]['Determiner'];
}
$pdf->MultiCell($props['whtml'], 5, $by, 0, 'L', 0, 1, $labelbody_pos['x'][$x], $labelbody_pos['y'][$y] + 15, true, 0, true, true, 0, 'T', false);
$pdf->MultiCell($props['whtml'], 5, $labeldata[$i]['DeterminedDate'], 0, 'R', 0, 1, $labelbody_pos['x'][$x], $labelbody_pos['y'][$y] + 15, true, 0, true, true, 0, 'T', false);
}
$pdf->lastPage();
$pdf->Output('mellabel.pdf', 'I');
}
示例4: blended_draw_multichoice_question
/**
* Draws a multichoice question with many options on the TCPDF object.
* It relies on the current X,Y pointer of the TCPDF context.
*
* Generates some metrics about the layout.
* retuns an object with the following structure:
* object->coords[]->X
* ->Y
* ->H
* ->W
* ->marks[]->X
* ->Y
* ->H
* ->W
*
* @param $pdf
* @param $question
* @param $columnsWidth
* @param $ln Indicates where the current position should go after the call. Possible values are:
* 0: to the right
* 1: to the beginning of the next line
* 2: below
* @param $markSize
* @param $fillMarks
* @param $numcols
* @param $border draws a border
* @return object with a coords and marks properties and TCPDF object.
*/
function blended_draw_multichoice_question(TCPDF $pdf, &$dims, $question, $columnsWidth, $ln, $markSize = 3, $fillMarks = false, $numcols = 2, $border = true)
{
$borderDescription = false;
$borderOption = false;
$Xorigin = $pdf->GetX();
$Yorigin = $pdf->GetY();
$maxY = 0;
//$lastH=$pdf->getLastH();
$setlasH = $pdf->setLastH(1);
print "Question: {$question->questiontext}</p>";
//output question
blended_saveXY($dims, $pdf, $question->id);
$pdf->writeHTMLCell($columnsWidth, 1, '', '', $question->questiontext, $borderDescription, 0, 0, false);
blended_saveWH($dims, $pdf, $question->id);
$pdf->Ln();
$pdf->SetX($Xorigin);
$name = $question->id;
//output options
$formatoptions = new stdClass();
$formatoptions->noclean = true;
$formatoptions->para = false;
$i = 0;
//Las marcas se ordenan segun
if ($question->options->single == 1) {
$type = 'CIRCLE';
} else {
$type = 'SQUARE';
}
foreach ($question->anss as $id => $anss) {
// format_text($answer->answer, FORMAT_MOODLE, $formatoptions, $cmoptions->course);
//$option = $anss->answer;
$option = format_text($anss->answer, FORMAT_MOODLE, $formatoptions);
//circulo para marcar con un número correlativo a cada respuesta.
// la marca $i+1 corresponde con la respuesta $id (ver $state)
// little margin
$pdf->Cell(1, $markSize, '', 0, 0, 'C', 0, '', '');
global $letters;
blended_draw_mark($pdf, $markSize, $dims, $label = $anss->id, $name, $text = $letters[$i], $fillMarks, $type);
blended_saveXY($dims, $pdf);
$pdf->writeHTMLCell($columnsWidth / 2 - $markSize - 1, 0, '', '', $option, $borderOption, 0, false);
blended_saveWH($dims, $pdf);
$coord = $dims->coords[(int) (count($dims->coords) - 1)];
$renderedY = $coord->Y + $coord->H;
$maxY = max($maxY, $renderedY);
if ($i % $numcols == 1) {
$pdf->SetY($maxY);
$pdf->SetX($Xorigin);
}
$i++;
}
//register global dimensions
$coord = new stdClass();
$coord->X = $dims->coords[$question->id]->X;
$coord->Y = $dims->coords[$question->id]->Y;
$coord->W = $columnsWidth;
$a = $dims->coords[count($dims->coords) - 1]->H;
$b = $dims->coords[count($dims->coords) - 3]->H;
$maxH = max($a, $b);
$Yfinal = $pdf->GetY();
$coord->H2 = $Yfinal - $Yorigin;
$coord->H = $dims->coords[count($dims->coords) - 1]->Y + $maxH - $coord->Y;
$dims->coords[$question->id] = $coord;
switch ($ln) {
case 0:
$pdf->SetXY($coord->X + $coord->W, $coord->Y);
break;
case 1:
$margins = $pdf->getMargins();
$pdf->SetXY($margins['left'], $coord->Y + $coord->H);
break;
case 2:
$pdf->SetXY($coord->X + $coord->W, $coord->Y, $coord->Y + $coord->H);
//.........这里部分代码省略.........
示例5: floor
//dc_YDown(1);
$pdf->SetX($x);
$pdf->setCellPaddings(0, 0.5, 0, 0.5);
$pdf->SetFont('dejavusans', 'B', 10, '', true);
$cx = str_replace(" ", "\n", $b['callnumber']);
$pdf->MultiCell($lwidth, 0, $cx, 1, 'C', 0, 1, '', '', true);
//dc_YDown(1);
if ($k == 0) {
$lheight += $pdf->getLastH();
}
}
if ($plbcode == 'Y') {
$pl = true;
dc_YDown(1);
$pdf->SetX($x);
$ty1 = $pdf->GetY();
$pdf->write1DBarcode($b['barcode'], 'C39', '', '', $lwidth, 9, 0.4, $style, 'N');
$ty2 = $pdf->GetY();
//$pdf->Line($x,$ty1,$x+$lwidth,$ty1);
//$pdf->Line($x,$ty1,$x,$ty2);
$pdf->Line($x, $ty2, $x + $lwidth, $ty2);
//$pdf->Line($x+60,$ty1,$x+60,$ty2);
if ($k == 0) {
$lheight += 10;
}
}
// End of Print label >>
if ($pl) {
if ($k == 0) {
$k = 1;
$nrow = floor($dcPageH / $lheight);
示例6: cetak_infohalaman
function cetak_infohalaman($label,$info){
global $pdf;
$pdf->MultiCell(30, 0, $label, 0, 'L', 0, 0, '', '', true);
$pdf->MultiCell(100, 0, ': '.$info, 0, 'L', 0, 0, '', '', true);
$pdf->Ln();
}
function cetak_infohalaman2($label,$info){
global $pdf,$dcPageW;
$pdf->MultiCell(30, 0, $label, 0, 'L', 0, 0, $dcPageW-50, '', true);
$pdf->MultiCell(100, 0, ': '.$info, 0, 'L', 0, 0, '', '', true);
$pdf->Ln();
}
// 4. Cetak info halaman: Sesuaikan Page Selection Bar >> Edit
$ty=$pdf->GetY();
cetak_infohalaman('Nama stock opname',$data_so['nama']);
cetak_infohalaman('Tanggal mulai',fftgl($data_so['tanggal1']));
cetak_infohalaman('Tanggal selesai',fftgl($data_so['tanggal2']));
if($lap_sum==1){
$pdf->SetY($ty);
cetak_infohalaman2('Total item',$data_so['nitem'].' item');
cetak_infohalaman2('Item dicek',$data_so['nceky'].' item');
cetak_infohalaman2('Item hilang',($data_so['nitem']-$data_so['nceky']).' item');
}
dc_YDown(2);
// 5. Header tabel: samakan di $xtable->head() >> Edit
$phead=array(
array('No.','C',11),
示例7: TCPDF
require Yii::getPathOfAlias('webroot') . '/protected/extensions/tcpdf/' . 'tcpdf.php';
// Data loading
$pdf = new TCPDF('P', PDF_UNIT, 'Legal', true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(User::model()->findByPK(Yii::app()->user->name)->emp->Fullname);
$pdf->SetTitle('History Ordinance Report');
// set default header data
$pdf->SetHeaderData('banner.jpg', PDF_HEADER_LOGO_WIDTH, 'Legislative Information System - Provincial Government of La Union v1.0');
// 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(10, $pdf->GetY() + 40, 15);
$pdf->SetHeaderMargin(5);
$pdf->SetFooterMargin(30);
$pdf->SetAutoPageBreak(true, 65);
// set auto page breaks
//$pdf->SetAutoPageBreak(FALSE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once dirname(__FILE__) . '/lang/eng.php';
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'B', 18);
示例8: display
public function display($arraydata, $y_axis = 0, $fielddata = false)
{
//print_r($arraydata);echo "<br/>";
// $this->pdf->Cell(10,10,"SSSS");
$this->Rotate($arraydata["rotation"]);
if ($arraydata["rotation"] != "") {
if ($arraydata["rotation"] == "Left") {
$w = $arraydata["width"];
$arraydata["width"] = $arraydata["height"];
$arraydata["height"] = $w;
$this->pdf->SetXY($this->pdf->GetX() - $arraydata["width"], $this->pdf->GetY());
} elseif ($arraydata["rotation"] == "Right") {
$w = $arraydata["width"];
$arraydata["width"] = $arraydata["height"];
$arraydata["height"] = $w;
$this->pdf->SetXY($this->pdf->GetX(), $this->pdf->GetY() - $arraydata["height"]);
} elseif ($arraydata["rotation"] == "UpsideDown") {
//soverflow"=>$stretchoverflow,"poverflow"
$arraydata["soverflow"] = true;
$arraydata["poverflow"] = true;
// $w=$arraydata["width"];
// $arraydata["width"]=$arraydata["height"];
//$arraydata["height"]=$w;
$this->pdf->SetXY($this->pdf->GetX() - $arraydata["width"], $this->pdf->GetY() - $arraydata["height"]);
}
}
if ($arraydata["type"] == "SetFont") {
if ($arraydata["font"] == 'uGB') {
$this->pdf->isUnicode = true;
} else {
$this->pdf->isUnicode = false;
}
$this->pdf->SetFont($arraydata["font"], $arraydata["fontstyle"], $arraydata["fontsize"]);
} elseif ($arraydata["type"] == "subreport") {
$this->runSubReport($arraydata);
} elseif ($arraydata["type"] == "MultiCell") {
$currenty = $this->pdf->GetY();
if ($fielddata == false) {
if ($this->allowprintuntill >= $currenty) {
$this->checkoverflow($arraydata, $this->updatePageNo($arraydata["txt"]));
}
} elseif ($fielddata == true) {
if ($this->allowprintuntill >= $currenty) {
$this->checkoverflow($arraydata, $this->updatePageNo($this->analyse_expression($arraydata["txt"], $arraydata["isPrintRepeatedValues"])));
} elseif ($this->parentcurrentband == "detail") {
$this->pdf->Cell(40, 10, "SADSD");
}
// echo $arraydata["txt"]."+\"|(".$y_axis.",".print_r($arraydata,true)."),$this->allowprintuntill,$newy\"<br/><br/>";
}
} elseif ($arraydata["type"] == "SetXY") {
$this->pdf->SetXY($arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis);
} elseif ($arraydata["type"] == "Cell") {
$currenty = $this->pdf->GetY();
if ($this->allowprintuntill >= $currenty) {
$this->pdf->Cell($arraydata["width"], $arraydata["height"], $this->updatePageNo($arraydata["txt"]), $arraydata["border"], $arraydata["ln"], $arraydata["align"], $arraydata["fill"], $arraydata["link"]);
} elseif ($this->parentcurrentband == "detail") {
$this->pdf->Cell(40, 10, "SADSD");
}
} elseif ($arraydata["type"] == "Rect") {
$this->pdf->Rect($arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"]);
} elseif ($arraydata["type"] == "Image") {
$path = $this->analyse_expression($arraydata["path"]);
$imgtype = substr($path, -3);
if ($imgtype == 'jpg' || right($path, 3) == 'jpg' || right($path, 4) == 'jpeg') {
$imgtype = "JPEG";
} elseif ($imgtype == 'png' || $imgtype == 'PNG') {
$imgtype = "PNG";
}
if (file_exists($path) || left($path, 4) == 'http') {
$this->pdf->Image($path, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"], $imgtype, $arraydata["link"]);
} elseif (left($path, 22) == "data:image/jpeg;base64") {
$imgtype = "JPEG";
$img = str_replace('data:image/jpeg;base64,', '', $path);
$imgdata = base64_decode($img);
$this->pdf->Image('@' . $imgdata, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"]);
//,$imgtype,$arraydata["link"]);
} elseif (left($path, 22) == "data:image/png;base64,") {
$imgtype = "PNG";
// $this->pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$img = str_replace('data:image/png;base64,', '', $path);
$imgdata = base64_decode($img);
$this->pdf->Image('@' . $imgdata, $arraydata["x"] + $this->arrayPageSetting["leftMargin"], $arraydata["y"] + $y_axis, $arraydata["width"], $arraydata["height"]);
//,$imgtype,$arraydata["link"]);
}
} elseif ($arraydata["type"] == "SetTextColor") {
$this->pdf->SetTextColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
} elseif ($arraydata["type"] == "SetDrawColor") {
$this->pdf->SetDrawColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
} elseif ($arraydata["type"] == "SetLineWidth") {
$this->pdf->SetLineWidth($arraydata["width"]);
} elseif ($arraydata["type"] == "Line") {
$this->pdf->Line($arraydata["x1"] + $this->arrayPageSetting["leftMargin"], $arraydata["y1"] + $y_axis, $arraydata["x2"] + $this->arrayPageSetting["leftMargin"], $arraydata["y2"] + $y_axis);
} elseif ($arraydata["type"] == "SetFillColor") {
$this->pdf->SetFillColor($arraydata["r"], $arraydata["g"], $arraydata["b"]);
} elseif ($arraydata["type"] == "lineChart") {
$this->showLineChart($arraydata, $y_axis);
} elseif ($arraydata["type"] == "barChart") {
$this->showBarChart($arraydata, $y_axis, 'barChart');
} elseif ($arraydata["type"] == "stackedBarChart") {
$this->showBarChart($arraydata, $y_axis, 'stackedBarChart');
//.........这里部分代码省略.........
示例9: gets
$fil .= $fstatus == "0" ? "" : " `status`='{$fstatus}'";
$filt .= $fil;
$fil .= $flevel == "0" ? "" : " `level`='{$flevel}'";
$filt .= $filt == "" ? $fil : " AND " . $fil;
$fil .= $fgroup == "0" ? "" : " `group`='{$fgroup}'";
$filt .= $filt == "" ? $fil : " AND " . $fil;
$fil .= $fgroup == "0" ? "" : " `division`='{$fdivision}'";
$filt .= $filt == "" ? $fil : " AND " . $fil;
$filt = $filt == "" ? "" : " WHERE " . $filt;
$ord = gets('sortby');
$sql = "SELECT * FROM employee " . $filt . " ORDER BY " . $ord;
//echo $sql;
$t = mysql_query($sql);
while ($f = dbFA($t)) {
$i = 0;
if ($pdf->GetY() > 190) {
$pdf->AddPage();
dc_tableHead($th, $tw);
}
if ($tc[dp_Name] == '1') {
$pdf->MultiCell($tw[$i++], 0, $f['name'], 0, 'L', 0, 0, '', '', true);
}
if ($tc[dp_Nip] == '1') {
$pdf->MultiCell($tw[$i++], 0, $f['nip'], 0, 'L', 0, 0, '', '', true);
}
if ($tc[dp_Status] == '1') {
$pdf->MultiCell($tw[$i++], 0, $mstr_status[$f['status']], 0, 'L', 0, 0, '', '', true);
}
if ($tc[dp_Level] == '1') {
$pdf->MultiCell($tw[$i++], 0, $mstr_level[$f['level']], 0, 'L', 0, 0, '', '', true);
}
示例10: addRow
/**
* Add a row
*
* @param array|object $row row data
* @param int $index row index
* @return TcTable
*/
private function addRow($row, $index = null)
{
$this->copyDefaultColumnDefinitions($row, $index);
if ($this->trigger(self::EV_ROW_ADD, [$row, $index]) === false) {
return $this;
}
$h = current($this->rowDefinition)['height'];
$page_break_trigger = $this->pdf->getPageHeight() - $this->pdf->getBreakMargin();
if ($this->pdf->GetY() + $h >= $page_break_trigger) {
if ($this->trigger(self::EV_PAGE_ADD, [$row, $index, false]) !== false) {
$this->pdf->AddPage();
$this->trigger(self::EV_PAGE_ADDED, [$row, $index, false]);
}
}
foreach ($this->columnDefinition as $key => $value) {
if (isset($this->rowDefinition[$key])) {
$this->addCell($key, isset($row[$key]) ? $row[$key] : '', $row);
}
}
$this->trigger(self::EV_ROW_ADDED, [$row, $index]);
return $this;
}
示例11: while
$pdf->setCellPaddings(1, 1, 1, 1);
$pdf->SetTextColor(255);
$pdf->SetFillColor(0);
for ($i = 0; $i < count($thx); $i++) {
$pdf->MultiCell($twx[$i], 0, $thx[$i], 1, $tax[$i], 1, 0, '', '', true);
}
$pdf->Ln();
$pdf->SetTextColor(0);
// End of table head
// Table body formatting
$pdf->SetFont('dejavusans', '', 8, '', true);
$pdf->setCellPaddings(1, 1, 1, 1);
$row = 1;
while ($r = dbFA($t)) {
$i = 0;
if ($pdf->GetY() > 180) {
$pdf->AddPage();
// Table head
$pdf->SetTextColor(255);
$pdf->SetFillColor(0);
for ($i = 0; $i < count($thx); $i++) {
$pdf->MultiCell($twx[$i], 0, $thx[$i], 1, $tax[$i], 1, 0, '', '', true);
}
$pdf->Ln();
$pdf->SetTextColor(0);
// End of table head
//dc_YDown(2);
}
// Row data:
$y = mysql_query("SELECT * FROM catalog WHERE dcid='" . $r['catalog'] . "' LIMIT 0,1");
$f = mysql_fetch_array($y);
示例12: pruebapdfAction
public function pruebapdfAction()
{
// Include the main TCPDF library (search for installation path).
require_once 'tcpdf/examples/tcpdf_include.php';
ob_clean();
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'LETTER', true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 001');
$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 . ' 001', PDF_HEADER_STRING, array(0, 64, 255), array(0, 64, 128));
$pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
// 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)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once dirname(__FILE__) . '/lang/eng.php';
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set default font subsetting mode
$pdf->setFontSubsetting(true);
// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('helvetica', '', 9, '', true);
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
$pdf->SetFillColor(224, 235, 255);
$pdf->SetTextColor(0);
$pdf->SetFont('');
$fill = 0;
$pdf->Cell(10, 6, 'Nro', 1, 0, 'L', $fill);
$pdf->Cell(30, 6, 'Ubicación', 1, 0, 'L', $fill);
$pdf->Cell(30, 6, 'Sector', 1, 0, 'R', $fill);
$pdf->Cell(30, 6, 'Fecha', 1, 0, 'R', $fill);
$pdf->Cell(90, 6, 'Descripción', 1, 0, 'R', $fill);
$pdf->Ln();
$sum = 0;
$sw = 0;
for ($i = 1; $i < 100; $i++) {
$maxnocells = 0;
$cellcount = 0;
//write text first
$startX = $pdf->GetX();
$startY = $pdf->GetY();
//draw cells and record maximum cellcount
//cell height is 6 and width is 80
$cellcount = $pdf->MultiCell(10, 6, $i, 0, 'L', 0, 0);
if ($cellcount > $maxnocells) {
$maxnocells = $cellcount;
}
$cellcount = $pdf->MultiCell(30, 6, 'Cochabamba', 0, 'L', 0, 0);
if ($cellcount > $maxnocells) {
$maxnocells = $cellcount;
}
$cellcount = $pdf->MultiCell(30, 6, 'Sector', 0, 'L', 0, 0);
if ($cellcount > $maxnocells) {
$maxnocells = $cellcount;
}
$cellcount = $pdf->MultiCell(30, 6, 'Sector', 0, 'L', 0, 0);
if ($cellcount > $maxnocells) {
$maxnocells = $cellcount;
}
$cellcount = $pdf->MultiCell(90, 6, ' fjalañsdklfjalskd ', 0, 'L', 0, 0);
if ($cellcount > $maxnocells) {
$maxnocells = $cellcount;
}
$pdf->SetXY($startX, $startY);
//now do borders and fill
//cell height is 6 times the max number of cells
$pdf->MultiCell(10, $maxnocells * 5, '', 'LB', 'L', $sw, 0);
$pdf->MultiCell(30, $maxnocells * 5, '', 'LB', 'L', $sw, 0);
$pdf->MultiCell(30, $maxnocells * 5, '', 'LB', 'L', $sw, 0);
$pdf->MultiCell(30, $maxnocells * 5, '', 'LB', 'L', $sw, 0);
$pdf->MultiCell(90, $maxnocells * 5, '', 'LRB', 'L', $sw, 0);
$pdf->Ln();
$sw = !$sw;
$sum += $maxnocells;
if ($sum > 42) {
$pdf->AddPage();
$sum = 0;
}
//.........这里部分代码省略.........
示例13: checkoverflow
public function checkoverflow($arraydata, $txt = "", $maxheight = 0)
{
$newfont = $this->recommendFont($txt, $arraydata["font"], $arraydata["pdfFontName"]);
$this->pdf->SetFont($newfont, $this->pdf->getFontStyle(), $this->pdf->getFontSize());
$this->print_expression($arraydata);
if ($this->print_expression_result == true) {
// echo $arraydata["link"];
if ($arraydata["link"]) {
//print_r($arraydata);
//$this->debughyperlink=true;
// echo $arraydata["link"].",print:".$this->print_expression_result;
$arraydata["link"] = $this->analyse_expression($arraydata["link"], "");
//$this->debughyperlink=false;
}
//print_r($arraydata);
if ($arraydata["writeHTML"] == 1 && $this->pdflib == "TCPDF") {
$this->pdf->writeHTML($txt);
$this->pdf->Ln();
if ($this->currentband == 'detail') {
if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] == '') {
$this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
} else {
if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] < $this->pdf->GetY()) {
$this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
}
}
}
} elseif ($arraydata["poverflow"] == "false" && $arraydata["soverflow"] == "false") {
if ($arraydata["valign"] == "M") {
$arraydata["valign"] = "C";
}
if ($arraydata["valign"] == "") {
$arraydata["valign"] = "T";
}
while ($this->pdf->GetStringWidth($txt) > $arraydata["width"]) {
if ($txt != $this->pdf->getAliasNbPages() && $txt != ' ' . $this->pdf->getAliasNbPages()) {
$txt = substr_replace($txt, "", -1);
}
}
$x = $this->pdf->GetX();
$y = $this->pdf->GetY();
$text = $this->formatText($txt, $arraydata["pattern"]);
$this->pdf->Cell($arraydata["width"], $arraydata["height"], $text, $arraydata["border"], "", $arraydata["align"], $arraydata["fill"], $arraydata["link"], 0, true, "T", $arraydata["valign"]);
// if($arraydata["link"]) { //
// $tmpalign="Left";
// if($arraydata["valign"]=="R")
// $tmpalign="Right";
// elseif($arraydata["valign"]=="C")
// $tmpalign="Center";
// $textlen=strlen($text);
// $hidetxt="";
// for($l=0;$l<$textlen*2;$l++)
// $hidetxt.=" ";
// $imagehtml='<a style="text-decoration: none;" href="'.$arraydata["link"].'">'.
// '<div style="text-decoration: none;text-align:$tmpalign;float:left;width:'.$arraydata["width"].';margin:0px">'.$hidetxt.'</div></a>';
// // $this->pdf->writeHTMLCell($arraydata["width"],$arraydata["height"], $x,$y-$arraydata["height"],$imagehtml);//,1,0,true);
// }
//
$this->pdf->Ln();
if ($this->currentband == 'detail') {
if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] == '') {
$this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
} else {
if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] < $this->pdf->GetY()) {
$this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
}
}
}
} elseif ($arraydata["soverflow"] == "true") {
if ($arraydata["valign"] == "C") {
$arraydata["valign"] = "M";
}
if ($arraydata["valign"] == "") {
$arraydata["valign"] = "T";
}
if ($maxheight == 0) {
$maxheight = $this->pdf->getNumLines($txt, $arraydata["width"]) * ($this->pdf->GetFontSize() * $this->pdf->getCellHeightRatio() + 2 * 1);
$maxheight = max($maxheight, $arraydata["height"]);
//FIXED para poder alinear verticalmente
}
$x = $this->pdf->GetX();
//if($arraydata["link"]) echo $arraydata["linktarget"].",".$arraydata["link"]."<br/><br/>";
$this->pdf->MultiCell($arraydata["width"], $arraydata["height"], $this->formatText($txt, $arraydata["pattern"]), $arraydata["border"], $arraydata["align"], $arraydata["fill"], 1, '', '', true, 0, false, true, $maxheight, $arraydata["valign"]);
//,$arraydata["valign"]);
if ($this->pdf->balancetext == '' && $this->currentband == 'detail') {
if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] == '') {
$this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
} else {
if ($this->maxpagey['page_' . ($this->pdf->getPage() - 1)] < $this->pdf->GetY()) {
$this->maxpagey['page_' . ($this->pdf->getPage() - 1)] = $this->pdf->GetY();
}
}
}
//$this->pageFooter();
if ($this->pdf->balancetext != '') {
$this->continuenextpageText = array('width' => $arraydata["width"], 'height' => $arraydata["height"], 'txt' => $this->pdf->balancetext, 'border' => $arraydata["border"], 'align' => $arraydata["align"], 'fill' => $arraydata["fill"], 'ln' => 1, 'x' => $x, 'y' => '', 'reset' => true, 'streth' => 0, 'ishtml' => false, 'autopadding' => true);
$this->pdf->balancetext = '';
$this->forcetextcolor_b = $this->textcolor_b;
$this->forcetextcolor_g = $this->textcolor_g;
$this->forcetextcolor_r = $this->textcolor_r;
//.........这里部分代码省略.........
示例14: gets
$fil .= $fauthor == "0" || $fauthor == "" ? "" : " `author`='{$fauthor}'";
$filt .= $fil;
$fil .= $fpublisher == "0" || $fpublisher == "" ? "" : " `publisher`='{$fpublisher}'";
$filt .= $filt == "" ? $fil : " AND " . $fil;
$fil .= $flanguage == "0" || $flanguage == "" ? "" : " `language`='{$flanguage}'";
$filt .= $filt == "" ? $fil : " AND " . $fil;
$filt = $filt == "" ? "" : " WHERE " . $filt;
$ord = gets('sortby');
$ord = $ord == "" ? "" : " ORDER BY " . $ord;
$sql = "SELECT * FROM `catalog` " . $filt . $ord;
//echo $sql;
$pdf->setCellPaddings(1, 1, 1, 1);
$t = mysql_query($sql);
while ($f = dbFA($t)) {
$i = 0;
if ($pdf->GetY() > 190) {
$pdf->AddPage();
dc_tableHead($th, $tw, $ta);
}
$ny = $pdf->GetY();
$my = 0;
if ($tc[dp_Title] == '1') {
$pdf->MultiCell($tw[$i++], 0, str_replace("\\'", "'", $f['title']), 0, 'L', 0, 0, '', '', true);
}
if ($pdf->getLastH() > $my) {
$my = $pdf->getLastH();
}
if ($tc[dp_Callnumber] == '1') {
$pdf->MultiCell($tw[$i++], 0, $f['callnumber'], 0, 'L', 0, 0, '', '', true);
}
if ($pdf->getLastH() > $my) {
示例15: add_table
public function add_table($table)
{
$absolute_position = $this->is_absolute($table);
if (!$absolute_position) {
$this->validate_position($table->ancho);
}
if ($table->fondo) {
$this->choose_color();
}
$this->SetLineWidth(0.3);
// set the width of the table
$margins = parent::getMargins();
if ($table->ancho == 0) {
if (parent::GetX() == $margins['left']) {
$table->ancho = $this->document_width;
} elseif (isset($table->x)) {
$table->ancho = $this->document_width - $table->x;
} else {
$table->ancho = $this->document_width - $this->last_width;
}
}
// get the widths of the headers
$encabezados = (array) $table->encabezados;
$string_widths = 0;
$has_superheaders = false;
foreach ($encabezados as $key => $cell) {
if (is_array($cell)) {
$has_superheaders = true;
foreach ($cell as $value) {
$string_widths += parent::GetStringWidth($value);
}
} else {
$string_widths += parent::GetStringWidth($cell);
}
}
if ($table->borde == 0) {
$header_border = 'B';
$data_border = 0;
} else {
$header_border = 1;
$data_border = 'LR';
}
// print headers
$x = parent::GetX();
$y = parent::GetY();
$widths = array();
$i = 0;
if ($has_superheaders) {
$cell_h = 26;
} else {
$cell_h = 13;
}
foreach ($encabezados as $index => $cell) {
if (is_array($cell)) {
$super_w = 0;
$super_x = parent::GetX();
foreach ($cell as $key => $value) {
array_push($widths, $this->GetStringWidth($value) / $string_widths * $table->ancho);
parent::WriteHTMLCell($widths[$i + $key], $cell_h / 2, parent::GetX(), $y + $cell_h / 2, "<b>" . $value . "</b>", $header_border, 0, $table->fondo, true, 'C');
$super_w += $widths[$i + $key];
}
parent::WriteHTMLCell($super_w, $cell_h / 2, $super_x, $y, "<b>" . $index . "</b>", $header_border, 0, $table->fondo, true, 'C');
parent::SetXY(parent::GetX(), $y + $cell_h / 2);
} else {
array_push($widths, $this->GetStringWidth($cell) / $string_widths * $table->ancho);
parent::WriteHTMLCell($widths[$index], $cell_h, parent::GetX(), $y, "<b>" . $cell . "</b>", $header_border, 0, $table->fondo, true, 'C');
}
$i++;
}
parent::Ln();
parent::SetX($x);
// print data
$fill = false;
foreach ($table->datos as $row) {
foreach ($row as $i => $field) {
$this->WriteHTMLCell($widths[$i], 6, '', '', $field, $data_border, 0, $fill, true, 'L', true);
}
if (parent::GetY() + 20 > parent::getPageHeight() - PDF_MARGIN_BOTTOM) {
parent::AddPage();
}
$height = parent::getLastH();
$this->Ln();
if ($table->fondo) {
$fill = !$fill;
}
}
$this->Cell(array_sum($widths), 0, '', 'T', $table->salto);
// set document positions
parent::SetXY(parent::GetX() + $this->separator, parent::GetY());
if ($absolute_position) {
$this->last_width = parent::GetX();
}
$y = parent::GetY();
if ($y > $this->last_height) {
$this->last_height = $y;
}
}