本文整理汇总了PHP中TCPDF_IMAGES类的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF_IMAGES类的具体用法?PHP TCPDF_IMAGES怎么用?PHP TCPDF_IMAGES使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TCPDF_IMAGES类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: startSVGElementHandler
/**
* Sets the opening SVG element handler function for the XML parser. (*** TO BE COMPLETED ***)
* @param $parser (resource) The first parameter, parser, is a reference to the XML parser calling the handler.
* @param $name (string) The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.
* @param $attribs (array) The third parameter, attribs, contains an associative array with the element's attributes (if any). The keys of this array are the attribute names, the values are the attribute values. Attribute names are case-folded on the same criteria as element names. Attribute values are not case-folded. The original order of the attributes can be retrieved by walking through attribs the normal way, using each(). The first key in the array was the first attribute, and so on.
* @param $ctm (array) tranformation matrix for clipping mode (starting transformation matrix).
* @author Nicola Asuni
* @since 5.0.000 (2010-05-02)
* @protected
*/
protected function startSVGElementHandler($parser, $name, $attribs, $ctm = array())
{
// check if we are in clip mode
if ($this->svgclipmode) {
$this->svgclippaths[$this->svgclipid][] = array('name' => $name, 'attribs' => $attribs, 'tm' => $this->svgcliptm[$this->svgclipid]);
return;
}
if ($this->svgdefsmode and !in_array($name, array('clipPath', 'linearGradient', 'radialGradient', 'stop'))) {
if (!isset($attribs['id'])) {
$attribs['id'] = 'DF_' . (count($this->svgdefs) + 1);
}
$this->svgdefs[$attribs['id']] = array('name' => $name, 'attribs' => $attribs);
return;
}
$clipping = false;
if ($parser == 'clip-path') {
// set clipping mode
$clipping = true;
}
// get styling properties
$prev_svgstyle = $this->svgstyles[count($this->svgstyles) - 1];
// previous style
$svgstyle = $this->svgstyles[0];
// set default style
if ($clipping and !isset($attribs['fill']) and (!isset($attribs['style']) or !preg_match('/[;\\"\\s]{1}fill[\\s]*:[\\s]*([^;\\"]*)/si', $attribs['style'], $attrval))) {
// default fill attribute for clipping
$attribs['fill'] = 'none';
}
if (isset($attribs['style']) and !TCPDF_STATIC::empty_string($attribs['style'])) {
// fix style for regular expression
$attribs['style'] = ';' . $attribs['style'];
}
foreach ($prev_svgstyle as $key => $val) {
if (in_array($key, TCPDF_IMAGES::$svginheritprop)) {
// inherit previous value
$svgstyle[$key] = $val;
}
if (isset($attribs[$key]) and !TCPDF_STATIC::empty_string($attribs[$key])) {
// specific attribute settings
if ($attribs[$key] == 'inherit') {
$svgstyle[$key] = $val;
} else {
$svgstyle[$key] = $attribs[$key];
}
} elseif (isset($attribs['style']) and !TCPDF_STATIC::empty_string($attribs['style'])) {
// CSS style syntax
$attrval = array();
if (preg_match('/[;\\"\\s]{1}' . $key . '[\\s]*:[\\s]*([^;\\"]*)/si', $attribs['style'], $attrval) and isset($attrval[1])) {
if ($attrval[1] == 'inherit') {
$svgstyle[$key] = $val;
} else {
$svgstyle[$key] = $attrval[1];
}
}
}
}
// transformation matrix
if (!empty($ctm)) {
$tm = $ctm;
} else {
//$tm = $this->svgstyles[(count($this->svgstyles) - 1)]['transfmatrix'];
$tm = array(1, 0, 0, 1, 0, 0);
}
if (isset($attribs['transform']) and !empty($attribs['transform'])) {
$tm = TCPDF_STATIC::getTransformationMatrixProduct($tm, TCPDF_STATIC::getSVGTransformMatrix($attribs['transform']));
}
$svgstyle['transfmatrix'] = $tm;
$invisible = false;
if ($svgstyle['visibility'] == 'hidden' or $svgstyle['visibility'] == 'collapse' or $svgstyle['display'] == 'none') {
// the current graphics element is invisible (nothing is painted)
$invisible = true;
}
// process tag
switch ($name) {
case 'defs':
$this->svgdefsmode = true;
break;
// clipPath
// clipPath
case 'clipPath':
if ($invisible) {
break;
}
$this->svgclipmode = true;
if (!isset($attribs['id'])) {
$attribs['id'] = 'CP_' . (count($this->svgcliptm) + 1);
}
$this->svgclipid = $attribs['id'];
$this->svgclippaths[$this->svgclipid] = array();
$this->svgcliptm[$this->svgclipid] = $tm;
//.........这里部分代码省略.........
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:101,代码来源:tcpdf.php
示例2: Header
public function Header()
{
if ($this->vendor->vendor_letter_header != 1) {
return;
}
if ($this->header_xobjid === false) {
// start a new XObject Template
$this->header_xobjid = $this->startTemplate($this->w, $this->tMargin);
$headerfont = $this->getHeaderFont();
$headerdata = $this->getHeaderData();
$this->y = $this->header_margin;
$headertxt = '<style>' . $this->css . '</style>';
$headertxt .= '<div id="vmdoc-header" class="vmdoc-header">' . $this->replace_variables($headerdata['string']) . '</div>';
$currentCHRF = $this->getCellHeightRatio();
$this->setCellHeightRatio($this->vendor->vendor_letter_header_cell_height_ratio);
if ($this->rtl) {
$this->x = $this->w - $this->original_rMargin;
} else {
$this->x = $this->original_lMargin;
}
$header_x = $this->getRTL() ? $this->original_rMargin : $this->original_lMargin;
$cw = $this->w - $this->original_lMargin - $this->original_rMargin;
if ($headerdata['logo'] and $headerdata['logo'] != K_BLANK_IMAGE) {
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_images.php');
if ($this->tcpdf6) {
if (!class_exists('TCPDF_IMAGES')) {
require VMPATH_LIBS . DS . 'tcpdf' . DS . 'include' . DS . 'tcpdf_images.php';
}
$imgtype = TCPDF_IMAGES::getImageFileType(VMPATH_ROOT . DS . $headerdata['logo']);
} else {
$imgtype = $this->getImageFileType(VMPATH_ROOT . DS . $headerdata['logo']);
}
if ($imgtype == 'eps' or $imgtype == 'ai') {
$this->ImageEps(VMPATH_ROOT . DS . $headerdata['logo'], '', '', $headerdata['logo_width']);
} elseif ($imgtype == 'svg') {
$this->ImageSVG(VMPATH_ROOT . DS . $headerdata['logo'], '', '', $headerdata['logo_width']);
} else {
$this->Image(VMPATH_ROOT . DS . $headerdata['logo'], '', '', $headerdata['logo_width']);
}
$imgy = $this->getImageRBY();
$header_x += $headerdata['logo_width'] * 1.1;
$cw -= $headerdata['logo_width'] * 1.1;
} else {
$imgy = $this->y;
}
// set starting margin for text data cell
$this->SetTextColorArray($this->header_text_color);
// header string
$this->SetFont($headerfont[0], $headerfont[1], $headerfont[2]);
$this->SetX($header_x);
$this->writeHTMLCell($cw, 0, $this->x, $this->header_margin, $headertxt, '', 2, false, true, '', true);
// print an ending header line
if ($this->vendor->vendor_letter_header_line == 1) {
$this->SetLineStyle(array('width' => 0.85 / $this->k, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $headerdata['line_color']));
$this->SetY(max($imgy, $this->y));
if ($this->rtl) {
$this->SetX($this->original_rMargin);
} else {
$this->SetX($this->original_lMargin);
}
$this->Cell($this->w - $this->original_lMargin - $this->original_rMargin, 0, '', 'T', 0, 'C');
}
$this->setCellHeightRatio($currentCHRF);
$this->endTemplate();
}
// print header template
$x = 0;
$dx = 0;
if (!$this->header_xobj_autoreset and $this->booklet and $this->page % 2 == 0) {
// adjust margins for booklet mode
$dx = $this->original_lMargin - $this->original_rMargin;
}
if ($this->rtl) {
$x = $this->w + $dx;
} else {
$x = 0 + $dx;
}
$this->printTemplate($this->header_xobjid, $x, 0, 0, 0, '', '', false);
if ($this->header_xobj_autoreset) {
// reset header xobject template at each page
$this->header_xobjid = false;
}
}
开发者ID:cybershocik,项目名称:Darek,代码行数:86,代码来源:vmpdf.php
示例3: setImage
private function setImage($headerdata)
{
$imgtype = TCPDF_IMAGES::getImageFileType(K_PATH_IMAGES . $headerdata['logo']);
if ($imgtype === 'eps' or $imgtype === 'ai') {
$this->ImageEps(K_PATH_IMAGES . $headerdata['logo'], '', '', $headerdata['logo_width']);
} elseif ($imgtype === 'svg') {
$this->ImageSVG(K_PATH_IMAGES . $headerdata['logo'], '', '', $headerdata['logo_width']);
} else {
$this->Image(K_PATH_IMAGES . $headerdata['logo'], '', '', $headerdata['logo_width']);
}
}
开发者ID:josephzhao,项目名称:map2ucore,代码行数:11,代码来源:Map2uPDF.php
示例4: startSVGElementHandler
/**
* Sets the opening SVG element handler function for the XML parser. (*** TO BE COMPLETED ***)
* @param $parser (resource) The first parameter, parser, is a reference to the XML parser calling the handler.
* @param $name (string) The second parameter, name, contains the name of the element for which this handler is called. If case-folding is in effect for this parser, the element name will be in uppercase letters.
* @param $attribs (array) The third parameter, attribs, contains an associative array with the element's attributes (if any). The keys of this array are the attribute names, the values are the attribute values. Attribute names are case-folded on the same criteria as element names. Attribute values are not case-folded. The original order of the attributes can be retrieved by walking through attribs the normal way, using each(). The first key in the array was the first attribute, and so on.
* @param $ctm (array) tranformation matrix for clipping mode (starting transformation matrix).
* @author Nicola Asuni
* @since 5.0.000 (2010-05-02)
* @protected
*/
protected function startSVGElementHandler($parser, $name, $attribs, $ctm=array()) {
$name = $this->removeTagNamespace($name);
// check if we are in clip mode
if ($this->svgclipmode) {
$this->svgclippaths[$this->svgclipid][] = array('name' => $name, 'attribs' => $attribs, 'tm' => $this->svgcliptm[$this->svgclipid]);
return;
}
if ($this->svgdefsmode AND !in_array($name, array('clipPath', 'linearGradient', 'radialGradient', 'stop'))) {
if (isset($attribs['id'])) {
$attribs['child_elements'] = array();
$this->svgdefs[$attribs['id']] = array('name' => $name, 'attribs' => $attribs);
return;
}
if (end($this->svgdefs) !== FALSE) {
$last_svgdefs_id = key($this->svgdefs);
if (isset($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'])) {
$attribs['id'] = 'DF_'.(count($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements']) + 1);
$this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'][$attribs['id']] = array('name' => $name, 'attribs' => $attribs);
return;
}
}
return;
}
$clipping = false;
if ($parser == 'clip-path') {
// set clipping mode
$clipping = true;
}
// get styling properties
$prev_svgstyle = $this->svgstyles[max(0,(count($this->svgstyles) - 1))]; // previous style
$svgstyle = $this->svgstyles[0]; // set default style
if ($clipping AND !isset($attribs['fill']) AND (!isset($attribs['style']) OR (!preg_match('/[;\"\s]{1}fill[\s]*:[\s]*([^;\"]*)/si', $attribs['style'], $attrval)))) {
// default fill attribute for clipping
$attribs['fill'] = 'none';
}
if (isset($attribs['style']) AND !TCPDF_STATIC::empty_string($attribs['style']) AND ($attribs['style'][0] != ';')) {
// fix style for regular expression
$attribs['style'] = ';'.$attribs['style'];
}
foreach ($prev_svgstyle as $key => $val) {
if (in_array($key, TCPDF_IMAGES::$svginheritprop)) {
// inherit previous value
$svgstyle[$key] = $val;
}
if (isset($attribs[$key]) AND !TCPDF_STATIC::empty_string($attribs[$key])) {
// specific attribute settings
if ($attribs[$key] == 'inherit') {
$svgstyle[$key] = $val;
} else {
$svgstyle[$key] = $attribs[$key];
}
} elseif (isset($attribs['style']) AND !TCPDF_STATIC::empty_string($attribs['style'])) {
// CSS style syntax
$attrval = array();
if (preg_match('/[;\"\s]{1}'.$key.'[\s]*:[\s]*([^;\"]*)/si', $attribs['style'], $attrval) AND isset($attrval[1])) {
if ($attrval[1] == 'inherit') {
$svgstyle[$key] = $val;
} else {
$svgstyle[$key] = $attrval[1];
}
}
}
}
// transformation matrix
if (!empty($ctm)) {
$tm = $ctm;
} else {
$tm = array(1,0,0,1,0,0);
}
if (isset($attribs['transform']) AND !empty($attribs['transform'])) {
$tm = TCPDF_STATIC::getTransformationMatrixProduct($tm, TCPDF_STATIC::getSVGTransformMatrix($attribs['transform']));
}
$svgstyle['transfmatrix'] = $tm;
$invisible = false;
if (($svgstyle['visibility'] == 'hidden') OR ($svgstyle['visibility'] == 'collapse') OR ($svgstyle['display'] == 'none')) {
// the current graphics element is invisible (nothing is painted)
$invisible = true;
}
// process tag
switch($name) {
case 'defs': {
$this->svgdefsmode = true;
break;
}
// clipPath
case 'clipPath': {
if ($invisible) {
break;
}
$this->svgclipmode = true;
//.........这里部分代码省略.........
开发者ID:ketanbgm,项目名称:Billing--application-codeigniter-mysql-ajax,代码行数:101,代码来源:tcpdf.php
示例5: Header
/**
* This method is used to render the page header and overrides the original Header() method on TCPDF.
* @public
*/
public function Header()
{
if ($this->header_xobjid === false) {
// start a new XObject Template
$this->header_xobjid = $this->startTemplate($this->w, $this->tMargin);
$headerfont = $this->getHeaderFont();
$headerdata = $this->getHeaderData();
$this->y = $this->header_margin;
if ($this->rtl) {
$this->x = $this->w - $this->original_rMargin;
} else {
$this->x = $this->original_lMargin;
}
if ($headerdata['logo'] and $headerdata['logo'] != K_BLANK_IMAGE) {
$imgtype = TCPDF_IMAGES::getImageFileType(K_PATH_IMAGES . $headerdata['logo']);
if ($imgtype == 'eps' or $imgtype == 'ai') {
$this->ImageEps(K_PATH_IMAGES . $headerdata['logo'], '', '', $headerdata['logo_width']);
} elseif ($imgtype == 'svg') {
$this->ImageSVG(K_PATH_IMAGES . $headerdata['logo'], '', '', $headerdata['logo_width']);
} else {
$this->Image(K_PATH_IMAGES . $headerdata['logo'], '', '', $headerdata['logo_width']);
}
$imgy = $this->getImageRBY();
} else {
$imgy = $this->y;
}
$cell_height = round($this->cell_height_ratio * $headerfont[2] / $this->k, 2);
// set starting margin for text data cell
if ($this->getRTL()) {
$header_x = $this->original_rMargin + $headerdata['logo_width'] * 1.1;
} else {
$header_x = $this->original_lMargin + $headerdata['logo_width'] * 1.1;
}
$cw = $this->w - $this->original_lMargin - $this->original_rMargin - $headerdata['logo_width'] * 1.1;
$this->SetTextColor(0, 0, 0);
// header title
$this->SetFont($headerfont[0], 'B', $headerfont[2] + 1);
$this->SetX($header_x);
$this->Cell($cw, $cell_height, $headerdata['title'], 0, 1, '', 0, '', 0);
// header string
$this->SetFont($headerfont[0], $headerfont[1], $headerfont[2]);
$this->SetX($header_x);
$this->MultiCell($cw, $cell_height, $headerdata['string'], 0, '', 0, 1, '', '', true, 0, false);
// print an ending header line
$this->SetLineStyle(array('width' => 0.85 / $this->k, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
if (!empty($this->tcexam_backlink)) {
// set style for barcode
$style = array('border' => false, 'vpadding' => 0, 'hpadding' => 0, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
// QRCODE
$w = PDF_MARGIN_TOP - PDF_MARGIN_HEADER - 5.7 / $this->k;
$y = PDF_MARGIN_HEADER;
if ($this->rtl) {
$x = PDF_MARGIN_LEFT + $w;
} else {
$x = $this->w - PDF_MARGIN_RIGHT - $w;
}
// write QR-Code on header
$this->write2DBarcode($this->tcexam_backlink, 'QRCODE,L', $x, $y, $w, $w, $style, 'N');
}
$this->SetY(2.835 / $this->k + max($imgy, $this->y));
if ($this->rtl) {
$this->SetX($this->original_rMargin);
} else {
$this->SetX($this->original_lMargin);
}
$this->Cell($this->w - $this->original_lMargin - $this->original_rMargin, 0, '', 'T', 0, 'C');
$this->endTemplate();
}
// print header template
$x = 0;
$dx = 0;
if ($this->booklet and $this->page % 2 == 0) {
// adjust margins for booklet mode
$dx = $this->original_lMargin - $this->original_rMargin;
}
if ($this->rtl) {
$x = $this->w + $dx;
} else {
$x = 0 + $dx;
}
$this->printTemplate($this->header_xobjid, $x, 0, 0, 0, '', '', false);
}
开发者ID:dungvu,项目名称:tcexam,代码行数:86,代码来源:tcpdfex.php
注:本文中的TCPDF_IMAGES类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论