本文整理汇总了PHP中TCPDF_COLORS类的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF_COLORS类的具体用法?PHP TCPDF_COLORS怎么用?PHP TCPDF_COLORS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TCPDF_COLORS类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Handles rendering the element on the pdf.
*
* @param pdf $pdf the pdf object
* @param bool $preview true if it is a preview, false otherwise
*/
public function render($pdf, $preview)
{
$colour = TCPDF_COLORS::convertHTMLColorToDec($this->element->colour, $colour);
$pdf->SetLineStyle(array('width' => $this->element->data, 'color' => $colour));
$pdf->Line(0, 0, $pdf->getPageWidth(), 0);
$pdf->Line($pdf->getPageWidth(), 0, $pdf->getPageWidth(), $pdf->getPageHeight());
$pdf->Line(0, $pdf->getPageHeight(), $pdf->getPageWidth(), $pdf->getPageHeight());
$pdf->Line(0, 0, 0, $pdf->getPageHeight());
}
开发者ID:rezaies,项目名称:moodle-mod_customcert,代码行数:15,代码来源:lib.php
示例2: startSVGElementHandler
//.........这里部分代码省略.........
} else {
$this->svggradients[$this->svggradientid]['gradientUnits'] = 'objectBoundingBox';
}
//$attribs['spreadMethod']
if (!isset($attribs['cx']) and !isset($attribs['cy']) or (isset($attribs['cx']) and substr($attribs['cx'], -1) == '%' or isset($attribs['cy']) and substr($attribs['cy'], -1) == '%')) {
$this->svggradients[$this->svggradientid]['mode'] = 'percentage';
} else {
$this->svggradients[$this->svggradientid]['mode'] = 'measure';
}
$cx = isset($attribs['cx']) ? $attribs['cx'] : 0.5;
$cy = isset($attribs['cy']) ? $attribs['cy'] : 0.5;
$fx = isset($attribs['fx']) ? $attribs['fx'] : $cx;
$fy = isset($attribs['fy']) ? $attribs['fy'] : $cy;
$r = isset($attribs['r']) ? $attribs['r'] : 0.5;
if (isset($attribs['gradientTransform'])) {
$this->svggradients[$this->svggradientid]['gradientTransform'] = TCPDF_STATIC::getSVGTransformMatrix($attribs['gradientTransform']);
}
$this->svggradients[$this->svggradientid]['coords'] = array($cx, $cy, $fx, $fy, $r);
if (isset($attribs['xlink:href']) and !empty($attribs['xlink:href'])) {
// gradient is defined on another place
$this->svggradients[$this->svggradientid]['xref'] = substr($attribs['xlink:href'], 1);
}
break;
case 'stop':
// gradient stops
if (substr($attribs['offset'], -1) == '%') {
$offset = floatval(substr($attribs['offset'], -1)) / 100;
} else {
$offset = floatval($attribs['offset']);
if ($offset > 1) {
$offset /= 100;
}
}
$stop_color = isset($svgstyle['stop-color']) ? TCPDF_COLORS::convertHTMLColorToDec($svgstyle['stop-color'], $this->spot_colors) : 'black';
$opacity = isset($svgstyle['stop-opacity']) ? $svgstyle['stop-opacity'] : 1;
$this->svggradients[$this->svggradientid]['stops'][] = array('offset' => $offset, 'color' => $stop_color, 'opacity' => $opacity);
break;
// paths
// paths
case 'path':
if ($invisible) {
break;
}
if (isset($attribs['d'])) {
$d = trim($attribs['d']);
if (!empty($d)) {
if ($clipping) {
$this->SVGTransform($tm);
$this->SVGPath($d, 'CNZ');
} else {
$this->StartTransform();
$this->SVGTransform($tm);
$obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, 0, 0, 1, 1, 'SVGPath', array($d, 'CNZ'));
if (!empty($obstyle)) {
$this->SVGPath($d, $obstyle);
}
$this->StopTransform();
}
}
}
break;
// shapes
// shapes
case 'rect':
if ($invisible) {
break;
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:67,代码来源:tcpdf.php
示例3: Footer
public function Footer()
{
if ($this->vendor->vendor_letter_footer == 1) {
$footertxt = '<style>' . $this->css . '</style>';
$footertxt .= '<div id="vmdoc-footer" class="vmdoc-footer">' . $this->replace_variables($this->vendor->vendor_letter_footer_html) . '</div>';
$currentCHRF = $this->getCellHeightRatio();
$this->setCellHeightRatio($this->vendor->vendor_letter_footer_cell_height_ratio);
if (!class_exists('JFile')) {
require VMPATH_LIBS . DS . 'joomla' . DS . 'filesystem' . DS . 'file.php';
}
$this->tcpdf6 = JFile::exists(VMPATH_LIBS . DS . 'tcpdf' . DS . 'include' . DS . 'tcpdf_colors.php');
if ($this->tcpdf6) {
$this->tcpdf6 = method_exists('TCPDF', 'getAllSpotColors');
}
if ($this->tcpdf6) {
$getAllSpotColors = TCPDF::getAllSpotColors();
$vlfooterlcolor = TCPDF_COLORS::convertHTMLColorToDec($this->vendor->vendor_letter_footer_line_color, $getAllSpotColors);
} else {
$vlfooterlcolor = $this->convertHTMLColorToDec($this->vendor->vendor_letter_footer_line_color);
}
//set style for cell border
$border = 0;
if ($this->vendor->vendor_letter_footer_line == 1) {
$line_width = 0.85 / $this->getScaleFactor();
$this->SetLineStyle(array('width' => $line_width, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $vlfooterlcolor));
$border = 'T';
}
// TODO: Implement cell_height
// $cell_height = round(($this->getCellHeightRatio() * $footerfont[2]) / $this->getScaleFactor(), 2);
$cell_height = 1;
$this->writeHTMLCell(0, $cell_height, '', '', $footertxt, $border, 1, 0, true, '', true);
// Set it back
$this->setCellHeightRatio($currentCHRF);
}
}
开发者ID:cybershocik,项目名称:Darek,代码行数:35,代码来源:vmpdf.php
示例4: startSVGElementHandler
//.........这里部分代码省略.........
OR ((isset($attribs['cx']) AND (substr($attribs['cx'], -1) == '%'))
OR (isset($attribs['cy']) AND (substr($attribs['cy'], -1) == '%')))) {
$this->svggradients[$this->svggradientid]['mode'] = 'percentage';
} elseif (isset($attribs['r']) AND is_numeric($attribs['r']) AND ($attribs['r']) <= 1) {
$this->svggradients[$this->svggradientid]['mode'] = 'ratio';
} else {
$this->svggradients[$this->svggradientid]['mode'] = 'measure';
}
$cx = (isset($attribs['cx']) ? $attribs['cx'] : 0.5);
$cy = (isset($attribs['cy']) ? $attribs['cy'] : 0.5);
$fx = (isset($attribs['fx']) ? $attribs['fx'] : $cx);
$fy = (isset($attribs['fy']) ? $attribs['fy'] : $cy);
$r = (isset($attribs['r']) ? $attribs['r'] : 0.5);
if (isset($attribs['gradientTransform'])) {
$this->svggradients[$this->svggradientid]['gradientTransform'] = TCPDF_STATIC::getSVGTransformMatrix($attribs['gradientTransform']);
}
$this->svggradients[$this->svggradientid]['coords'] = array($cx, $cy, $fx, $fy, $r);
if (isset($attribs['xlink:href']) AND !empty($attribs['xlink:href'])) {
// gradient is defined on another place
$this->svggradients[$this->svggradientid]['xref'] = substr($attribs['xlink:href'], 1);
}
break;
}
case 'stop': {
// gradient stops
if (substr($attribs['offset'], -1) == '%') {
$offset = floatval(substr($attribs['offset'], -1)) / 100;
} else {
$offset = floatval($attribs['offset']);
if ($offset > 1) {
$offset /= 100;
}
}
$stop_color = isset($svgstyle['stop-color'])?TCPDF_COLORS::convertHTMLColorToDec($svgstyle['stop-color'], $this->spot_colors):'black';
$opacity = isset($svgstyle['stop-opacity'])?$svgstyle['stop-opacity']:1;
$this->svggradients[$this->svggradientid]['stops'][] = array('offset' => $offset, 'color' => $stop_color, 'opacity' => $opacity);
break;
}
// paths
case 'path': {
if ($invisible) {
break;
}
if (isset($attribs['d'])) {
$d = trim($attribs['d']);
if (!empty($d)) {
$x = (isset($attribs['x'])?$attribs['x']:0);
$y = (isset($attribs['y'])?$attribs['y']:0);
$w = (isset($attribs['width'])?$attribs['width']:1);
$h = (isset($attribs['height'])?$attribs['height']:1);
$tm = TCPDF_STATIC::getTransformationMatrixProduct($tm, array($w, 0, 0, $h, $x, $y));
if ($clipping) {
$this->SVGTransform($tm);
$this->SVGPath($d, 'CNZ');
} else {
$this->StartTransform();
$this->SVGTransform($tm);
$obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, $w, $h, 'SVGPath', array($d, 'CNZ'));
if (!empty($obstyle)) {
$this->SVGPath($d, $obstyle);
}
$this->StopTransform();
}
}
}
break;
开发者ID:ketanbgm,项目名称:Billing--application-codeigniter-mysql-ajax,代码行数:67,代码来源:tcpdf.php
示例5: getAnnotOptFromJSProp
//.........这里部分代码省略.........
$opt['mk']['tp'] = 0;
break;
case 1:
case 'position.iconOnly':
$opt['mk']['tp'] = 1;
break;
case 2:
case 'position.iconTextV':
$opt['mk']['tp'] = 2;
break;
case 3:
case 'position.textIconV':
$opt['mk']['tp'] = 3;
break;
case 4:
case 'position.iconTextH':
$opt['mk']['tp'] = 4;
break;
case 5:
case 'position.textIconH':
$opt['mk']['tp'] = 5;
break;
case 6:
case 'position.overlay':
$opt['mk']['tp'] = 6;
break;
}
}
// fillColor: Specifies the background color for a field.
if (isset($prop['fillColor'])) {
if (is_array($prop['fillColor'])) {
$opt['mk']['bg'] = $prop['fillColor'];
} else {
$opt['mk']['bg'] = TCPDF_COLORS::convertHTMLColorToDec($prop['fillColor'], $spot_colors);
}
}
// strokeColor: Specifies the stroke color for a field that is used to stroke the rectangle of the field with a line as large as the line width.
if (isset($prop['strokeColor'])) {
if (is_array($prop['strokeColor'])) {
$opt['mk']['bc'] = $prop['strokeColor'];
} else {
$opt['mk']['bc'] = TCPDF_COLORS::convertHTMLColorToDec($prop['strokeColor'], $spot_colors);
}
}
// rotation: The rotation of a widget in counterclockwise increments.
if (isset($prop['rotation'])) {
$opt['mk']['r'] = $prop['rotation'];
}
// charLimit: Limits the number of characters that a user can type into a text field.
if (isset($prop['charLimit'])) {
$opt['maxlen'] = intval($prop['charLimit']);
}
if (!isset($ff)) {
$ff = 0;
// default value
}
// readonly: The read-only characteristic of a field. If a field is read-only, the user can see the field but cannot change it.
if (isset($prop['readonly']) and $prop['readonly'] == 'true') {
$ff += 1 << 0;
}
// required: Specifies whether a field requires a value.
if (isset($prop['required']) and $prop['required'] == 'true') {
$ff += 1 << 1;
}
// multiline: Controls how text is wrapped within the field.
if (isset($prop['multiline']) and $prop['multiline'] == 'true') {
开发者ID:risqiRPL,项目名称:iktrust-cabinet,代码行数:67,代码来源:tcpdf_static.php
示例6: Render
//.........这里部分代码省略.........
# $this->_tcpdf->Line(($startx-2),$starty,$startx-2, $endy); # debug line
# Now $rawdata ready to render, date range calculated ($datestart, $dateend)
if ($width <= 0) {
# if positive width not defined, stretch rendering to ALL available area.
$width = $this->_tcpdf->getPageWidth() - $startx - self::DEFAULT_MARGIN;
}
if ($height <= 0) {
# the same with height
$height = $this->_tcpdf->getPageHeight() - $starty - self::DEFAULT_MARGIN;
}
# auto-convert title to UTF-8 if needed.
$title = isset($this->_data['title']) ? $this->_convertCset(trim($this->_data['title'])) : '';
$shift = $ms_height = 0;
if ($title) {
$shift = 8;
$this->_tcpdf->SetFont('', '', floatval($this->_config['title_fontsize']));
$this->_tcpdf->MultiCell($width, $height, $title, 0, 'C', 0, 1, $startx, $starty);
}
if (count($this->_milestones)) {
$ms_height = $this->_config['ms_height'];
if ($ms_height < 1) {
$ms_height = $height * $ms_height;
}
}
if ($height - $shift - $ms_height < 16) {
$this->_error_message = 'Too small height to render Gantt chart !';
return false;
}
$descWidth = $this->_config['descr_width'] < 1.0 ? round($width * $this->_config['descr_width'], 2) : floatval($this->_config['descr_width']);
$timeline_x = $startx + $descWidth + 0.2;
$timelineWidth = $width - $descWidth - 0.2;
$ms_size = round($ms_height / 4, 2);
$max_x = $startx + $width;
$rgbText = TCPDF_COLORS::convertHTMLColorToDec($this->_config['text_color'], $spotc);
$rgbGrid = TCPDF_COLORS::convertHTMLColorToDec($this->_config['grid_color'], $spotc);
$rgbFill = TCPDF_COLORS::convertHTMLColorToDec($this->_config['box_bgcolor'], $spotc);
$rgbFill2 = TCPDF_COLORS::convertHTMLColorToDec($this->_config['box_bgcolor2'], $spotc);
$rgbBorder = TCPDF_COLORS::convertHTMLColorToDec($this->_config['box_border'], $spotc);
$msFill = TCPDF_COLORS::convertHTMLColorToDec($this->_config['ms_color'], $spotc);
$rgbShade = $this->_config['shade_color'] ? TCPDF_COLORS::convertHTMLColorToDec($this->_config['shade_color'], $spotc) : FALSE;
$lineStyle = array('width' => 0.1, 'dash' => 0, 'color' => $rgbGrid);
$height -= $shift + $ms_height;
if ($ms_height > 0) {
$this->_tcpdf->SetFillColorArray($rgbFill);
$this->_tcpdf->SetDrawColorArray($rgbGrid);
}
$grid_y = $starty + $shift;
$milestone_y = $grid_y + $ms_height / 2;
$timeline_y = $grid_y + $ms_height;
# gannt timeline top pos (first task row)
$step_y = round($height / count($rawdata), 2);
# one row height in the grid
$rgbBg = $this->_config['bgcolor'] ? TCPDF_COLORS::convertHTMLColorToDec($this->_config['bgcolor'], $spotc) : FALSE;
# $boxBorderStyle = array('width' => 0.1, 'dash' => 0, 'color' => $rgbBorder);
$this->_tcpdf->SetDrawColorArray($rgbGrid);
if ($rgbBg) {
$this->_tcpdf->SetFillColorArray($rgbBg);
$this->_tcpdf->Rect($startx, $grid_y, $width, $height + $ms_height, 'DF');
} else {
$this->_tcpdf->Rect($startx, $grid_y, $width, $height + $ms_height, '', $lineStyle, array());
}
if ($descWidth > 0) {
$this->_tcpdf->Line($startx + $descWidth, $grid_y, $timeline_x, $grid_y + $height + $ms_height, $lineStyle);
}
$dayWidth = round(($max_x - $timeline_x) / ($dateend - $datestart) * 86400, 3);
# Draw all vertical bars for month beginnings, and their dates at the bottom:
开发者ID:ajaboa,项目名称:crmpuan,代码行数:67,代码来源:PdfGantt.php
示例7: render_content
/**
* Common behaviour for rendering specified content on the pdf.
*
* @param pdf $pdf the pdf object
* @param string $content the content to render
*/
public function render_content($pdf, $content)
{
list($font, $attr) = $this->get_font();
$pdf->setFont($font, $attr, $this->element->size);
$fontcolour = TCPDF_COLORS::convertHTMLColorToDec($this->element->colour, $fontcolour);
$pdf->SetTextColor($fontcolour['R'], $fontcolour['G'], $fontcolour['B']);
$x = $this->element->posx;
$y = $this->element->posy;
$w = $this->element->width;
$align = $this->element->align;
$refpoint = $this->element->refpoint;
$actualwidth = $pdf->GetStringWidth($content);
if ($w and $w < $actualwidth) {
$actualwidth = $w;
}
switch ($refpoint) {
case CUSTOMCERT_REF_POINT_TOPRIGHT:
$x = $this->element->posx - $actualwidth;
if ($x < 0) {
$x = 0;
$w = $this->element->posx;
} else {
$w = $actualwidth;
}
break;
case CUSTOMCERT_REF_POINT_TOPCENTER:
$x = $this->element->posx - $actualwidth / 2;
if ($x < 0) {
$x = 0;
$w = $this->element->posx * 2;
} else {
$w = $actualwidth;
}
break;
}
if ($w) {
$w += 0.0001;
}
$pdf->setCellPaddings(0, 0, 0, 0);
$pdf->writeHTMLCell($w, 0, $x, $y, $content, 0, 0, false, true, $align);
}
开发者ID:rezaies,项目名称:moodle-mod_customcert,代码行数:47,代码来源:element.class.php
示例8: pdf_convertColor
public function pdf_convertColor($color)
{
return \TCPDF_COLORS::convertHTMLColorToDec($color, $this->spot_colors);
}
开发者ID:dapepe,项目名称:tymio,代码行数:4,代码来源:ixmlpdf.php
注:本文中的TCPDF_COLORS类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论