本文整理汇总了PHP中TCPDF::GetX方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::GetX方法的具体用法?PHP TCPDF::GetX怎么用?PHP TCPDF::GetX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF
的用法示例。
在下文中一共展示了TCPDF::GetX方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: text
/**
* Writes text at the specified x and y coordinates
*
* See {@link Style::munge_color()} for the format of the color array.
*
* @param float $x
* @param float $y
* @param string $text the text to write
* @param string $font the font file to use
* @param float $size the font size, in points
* @param array $color
* @param float $adjust word spacing adjustment
*/
function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $adjust = 0, $angle = 0, $blend = "Normal", $opacity = 1.0)
{
dompdf_debug("trace", "({$x}, {$y}, {$text}, " . basename($font) . ", {$size}, [{$color['0']}, {$color['1']}, {$color['2']}], {$adjust}, {$angle}, {$blend}, {$opacity})");
list($r, $g, $b) = $this->_get_rgb($color);
$this->_pdf->SetTextColor($r, $g, $b);
$this->_set_line_transparency($blend, $opacity);
$this->_set_fill_transparency($blend, $opacity);
$fontdata = $this->_get_font($font);
$this->_pdf->SetFont($fontdata['family'], $fontdata['style'], $size, $font);
//$this->_pdf->SetFontSize($size);
// ???
if ($adjust > 0) {
$a = explode(' ', $text);
//$this->_pdf->SetXY($x - 3, $y + (self::FONT_HEIGHT_SCALE - 1) * $size);
$this->_pdf->SetXY($x, $y);
//$y += self::FONT_HEIGHT_SCALE * $size + 1;
for ($i = 0; $i < count($a) - 1; $i++) {
$this->_pdf->Write($size, $a[$i] . ' ', '');
//$this->_pdf->Text($x, $y, $a[$i].' ');
$this->_pdf->SetX($this->_pdf->GetX() + $adjust);
//$x += $this->_pdf->GetX() + $adjust;
}
$this->_pdf->Write($size, $a[$i], '');
//$this->_pdf->Text($x, $y, $a[$i].' ');
} else {
if ($angle != 0) {
$this->_pdf->StartTransform();
//$y += self::FONT_HEIGHT_SCALE * $size;
//$y += $size;
$this->_pdf->Rotate(-$angle, $x, $y);
$this->_pdf->Text($x, $y, $text, false, false, true, 0, 0, '', 0, '', 0, false, 'T', 'T');
$this->_pdf->StopTransform();
} else {
//$pippo = $this->_pdf->getFontAscent($fontdata['family'], $fontdata['style'], $size);
//$y += $pippo / 8;
//$y = $y - 0.85 * $size; // + 0.8 * $size;
$this->_pdf->Text($x, $y, $text, false, false, true, 0, 0, '', 0, '', 0, false, 'T', 'T');
}
}
}
示例2: __construct
/**
* Create a table structure for TCPDF.
*
* @param \TCPDF $pdf
* @param string $cacheDir If the cache directory is given, resized images could be cached.
*/
public function __construct(\TCPDF $pdf, $cacheDir = null)
{
$this->pdf = $pdf;
$this->cacheDir = $cacheDir;
$this->xPosition = $pdf->GetX();
$this->setBorderWidth($pdf->GetLineWidth());
$this->setFontFamily($pdf->getFontFamily());
$this->setFontSize($pdf->getFontSizePt());
// FontSizePT is in points (not in user unit)
$this->setFontWeight(strpos($pdf->getFontStyle(), 'B') !== false ? self::FONT_WEIGHT_BOLD : self::FONT_WEIGHT_NORMAL);
}
示例3: 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
*/
function draw_multichoice_question(TCPDF $pdf, &$dims, $question, $columnsWidth, $ln, $markSize = 4, $fillMarks = false, $numcols = 2, $border = true)
{
$borderDescription = false;
$borderOption = false;
$Xorigin = $pdf->GetX();
$maxY = 0;
//$lastH=$pdf->getLastH();
$pdf->setLastH(1);
//output question
saveXY($dims, $pdf, $question->id);
$pdf->writeHTMLCell($columnsWidth, 1, '', '', $question->textHtml, $borderDescription, 0, 0, false);
saveWH($dims, $pdf, $question->id);
$pdf->Ln();
$pdf->SetX($Xorigin);
$name = $question->id;
//oputput options
for ($i = 0; $i < count($question->options); $i++) {
$option = $question->options[$i];
//circulo para marcar
draw_mark($pdf, $markSize, $dims, $i, $name, $fillMarks);
saveXY($dims, $pdf);
$pdf->writeHTMLCell($columnsWidth / 2 - $markSize, 0, '', '', $option, $borderOption, 0, false);
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);
}
}
//register global dimensions
$coord = new stdClass();
$coord->X = $dims->coords[$question->id]->X;
$coord->Y = $dims->coords[$question->id]->Y;
$coord->W = $columnsWidth;
$coord->H = $dims->coords[count($dims->coords) - 1]->Y + $dims->coords[count($dims->coords) - 1]->H - $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);
break;
}
if ($border) {
$pdf->Rect($coord->X, $coord->Y, $coord->W, $coord->H);
}
$pdf->setLastH($coord->H);
/*
//circulo para marcar
saveXY(&$coords,$pdf);
draw_mark($pdf,$markSize);
saveWH(&$coords,$pdf);
saveXY(&$coords,$pdf);
$pdf->writeHTMLCell($columnsWidth/2-$markSize,'','','',$question->options[0],1,0,0,0,'L');
saveWH(&$coords,$pdf);
//circulo para marcar
saveXY(&$coords,$pdf);
draw_mark($pdf,$markSize);
saveWH(&$coords,$pdf);
saveXY(&$coords,$pdf);
$pdf->writeHTMLCell($columnsWidth/2-$markSize,'','','',$question->options[1],1,1,0,0,'L');
saveWH(&$coords,$pdf);
//.........这里部分代码省略.........
示例4: 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;
}
}
示例5: 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');
//.........这里部分代码省略.........
示例6: 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;
}
//.........这里部分代码省略.........
示例7: 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;
//.........这里部分代码省略.........
示例8: blended_draw_description_question
/**
* Draws a simple question 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_description_question(TCPDF $pdf, &$dims, $question, $columnsWidth, $ln, $markSize = 4, $fillMarks = false, $numcols = 2, $border = true)
{
$borderDescription = true;
$borderOption = false;
$Xorigin = $pdf->GetX();
$maxY = 0;
//$lastH=$pdf->getLastH();
$pdf->setLastH(1);
//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;
blended_saveXY($dims, $pdf);
$pdf->Cell($columnsWidth, 40, '', $borderOption, 0, '');
blended_saveWH($dims, $pdf);
$coord = $dims->coords[(int) (count($dims->coords) - 1)];
$renderedY = $coord->Y + $coord->H;
//register global dimensions
$coord = new stdClass();
$coord->X = $dims->coords[$question->id]->X;
$coord->Y = $dims->coords[$question->id]->Y;
$coord->W = $columnsWidth;
$desc = $coord + 40;
$coord->H = $desc;
$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);
break;
}
if ($border) {
$pdf->Rect($coord->X, $coord->Y, $coord->W, $coord->H);
}
$pdf->setLastH($coord->H);
}