• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP TCPDF_STATIC类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中TCPDF_STATIC的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF_STATIC类的具体用法?PHP TCPDF_STATIC怎么用?PHP TCPDF_STATIC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TCPDF_STATIC类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _prepareValue

 /**
  * Writes a PDF value to the resulting document.
  *
  * Prepares the value for encryption of imported data by FPDI
  *
  * @param array $value
  */
 protected function _prepareValue(&$value)
 {
     switch ($value[0]) {
         case pdf_parser::TYPE_STRING:
             if ($this->encrypted) {
                 $value[1] = $this->_unescape($value[1]);
                 $value[1] = $this->_encrypt_data($this->_currentObjId, $value[1]);
                 $value[1] = TCPDF_STATIC::_escape($value[1]);
             }
             break;
         case pdf_parser::TYPE_STREAM:
             if ($this->encrypted) {
                 $value[2][1] = $this->_encrypt_data($this->_currentObjId, $value[2][1]);
                 $value[1][1]['/Length'] = array(pdf_parser::TYPE_NUMERIC, strlen($value[2][1]));
             }
             break;
         case pdf_parser::TYPE_HEX:
             if ($this->encrypted) {
                 $value[1] = $this->hex2str($value[1]);
                 $value[1] = $this->_encrypt_data($this->_currentObjId, $value[1]);
                 // remake hexstring of encrypted string
                 $value[1] = $this->str2hex($value[1]);
             }
             break;
     }
 }
开发者ID:shark0der,项目名称:FPDI-TCPDF,代码行数:33,代码来源:fpdi_bridge.php


示例2: pdf_write_value

 /**
  * Encryption of imported data by FPDI
  *
  * @param array $value
  */
 function pdf_write_value(&$value)
 {
     switch ($value[0]) {
         case PDF_TYPE_STRING:
             if ($this->encrypted) {
                 $value[1] = $this->_unescape($value[1]);
                 $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]);
                 $value[1] = TCPDF_STATIC::_escape($value[1]);
             }
             break;
         case PDF_TYPE_STREAM:
             if ($this->encrypted) {
                 $value[2][1] = $this->_encrypt_data($this->_current_obj_id, $value[2][1]);
                 $value[1][1]['/Length'] = array(PDF_TYPE_NUMERIC, strlen($value[2][1]));
             }
             break;
         case PDF_TYPE_HEX:
             if ($this->encrypted) {
                 $value[1] = $this->hex2str($value[1]);
                 $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]);
                 // remake hexstring of encrypted string
                 $value[1] = $this->str2hex($value[1]);
             }
             break;
     }
 }
开发者ID:surfingtime,项目名称:PDFMerger,代码行数:31,代码来源:fpdi2tcpdf_bridge.php


示例3: checkPageBreak

 /**
  * Add page if needed.
  *
  * @param float|int $h       cell height. Default value: 0
  * @param mixed     $y       starting y position, leave empty for current
  *                           position
  * @param boolean   $addpage if true add a page, otherwise only return
  *                           the true/false state
  *
  * @return boolean true in case of page break, false otherwise.
  */
 function checkPageBreak($h = 0, $y = '', $addpage = true)
 {
     if (TCPDF_STATIC::empty_string($y)) {
         $y = $this->y;
     }
     $current_page = $this->page;
     if ($y + $h > $this->PageBreakTrigger and !$this->InFooter and $this->AcceptPageBreak()) {
         if ($addpage) {
             //Automatic page break
             $x = $this->x;
             $this->AddPage($this->CurOrientation);
             $this->y = $this->dataY;
             $oldpage = $this->page - 1;
             $this_page_orm = $this->pagedim[$this->page]['orm'];
             $old_page_orm = $this->pagedim[$oldpage]['orm'];
             $this_page_olm = $this->pagedim[$this->page]['olm'];
             $old_page_olm = $this->pagedim[$oldpage]['olm'];
             if ($this->rtl) {
                 if ($this_page_orm != $old_page_orm) {
                     $this->x = $x - ($this_page_orm - $old_page_orm);
                 } else {
                     $this->x = $x;
                 }
             } else {
                 if ($this_page_olm != $old_page_olm) {
                     $this->x = $x + ($this_page_olm - $old_page_olm);
                 } else {
                     $this->x = $x;
                 }
             }
         }
         return true;
     }
     if ($current_page != $this->page) {
         // account for columns mode
         return true;
     }
     return false;
 }
开发者ID:saisai,项目名称:phpmyadmin,代码行数:50,代码来源:PMA_ExportPdf.class.php


示例4: _parsepng

 /**
  * Extract info from a PNG file without using the GD library.
  * @param $file (string) image file to parse
  * @return array structure containing the image data
  * @public static
  */
 public static function _parsepng($file)
 {
     $f = @fopen($file, 'rb');
     if ($f === false) {
         // Can't open image file
         return false;
     }
     //Check signature
     if (fread($f, 8) != chr(137) . 'PNG' . chr(13) . chr(10) . chr(26) . chr(10)) {
         // Not a PNG file
         return false;
     }
     //Read header chunk
     fread($f, 4);
     if (fread($f, 4) != 'IHDR') {
         //Incorrect PNG file
         return false;
     }
     $w = TCPDF_STATIC::_freadint($f);
     $h = TCPDF_STATIC::_freadint($f);
     $bpc = ord(fread($f, 1));
     $ct = ord(fread($f, 1));
     if ($ct == 0) {
         $colspace = 'DeviceGray';
     } elseif ($ct == 2) {
         $colspace = 'DeviceRGB';
     } elseif ($ct == 3) {
         $colspace = 'Indexed';
     } else {
         // alpha channel
         fclose($f);
         return 'pngalpha';
     }
     if (ord(fread($f, 1)) != 0) {
         // Unknown compression method
         fclose($f);
         return false;
     }
     if (ord(fread($f, 1)) != 0) {
         // Unknown filter method
         fclose($f);
         return false;
     }
     if (ord(fread($f, 1)) != 0) {
         // Interlacing not supported
         fclose($f);
         return false;
     }
     fread($f, 4);
     $channels = $ct == 2 ? 3 : 1;
     $parms = '/DecodeParms << /Predictor 15 /Colors ' . $channels . ' /BitsPerComponent ' . $bpc . ' /Columns ' . $w . ' >>';
     //Scan chunks looking for palette, transparency and image data
     $pal = '';
     $trns = '';
     $data = '';
     $icc = false;
     do {
         $n = TCPDF_STATIC::_freadint($f);
         $type = fread($f, 4);
         if ($type == 'PLTE') {
             // read palette
             $pal = TCPDF_STATIC::rfread($f, $n);
             fread($f, 4);
         } elseif ($type == 'tRNS') {
             // read transparency info
             $t = TCPDF_STATIC::rfread($f, $n);
             if ($ct == 0) {
                 // DeviceGray
                 $trns = array(ord($t[1]));
             } elseif ($ct == 2) {
                 // DeviceRGB
                 $trns = array(ord($t[1]), ord($t[3]), ord($t[5]));
             } else {
                 // Indexed
                 if ($n > 0) {
                     $trns = array();
                     for ($i = 0; $i < $n; ++$i) {
                         $trns[] = ord($t[$i]);
                     }
                 }
             }
             fread($f, 4);
         } elseif ($type == 'IDAT') {
             // read image data block
             $data .= TCPDF_STATIC::rfread($f, $n);
             fread($f, 4);
         } elseif ($type == 'iCCP') {
             // skip profile name
             $len = 0;
             while (ord(fread($f, 1)) != 0 and $len < 80) {
                 ++$len;
             }
             // get compression method
             if (ord(fread($f, 1)) != 0) {
//.........这里部分代码省略.........
开发者ID:amirjuve,项目名称:php,代码行数:101,代码来源:tcpdf_images.php


示例5: 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


示例6: getHyphenPatternsFromTEX

 /**
  * Returns an array of hyphenation patterns.
  * @param $file (string) TEX file containing hypenation patterns. TEX pattrns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/
  * @return array of hyphenation patterns
  * @author Nicola Asuni
  * @since 4.9.012 (2010-04-12)
  * @public static
  */
 public static function getHyphenPatternsFromTEX($file)
 {
     // TEX patterns are available at:
     // http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/
     $data = file_get_contents($file);
     $patterns = array();
     // remove comments
     $data = preg_replace('/\\%[^\\n]*/', '', $data);
     // extract the patterns part
     preg_match('/\\\\patterns\\{([^\\}]*)\\}/i', $data, $matches);
     $data = trim(substr($matches[0], 10, -1));
     // extract each pattern
     $patterns_array = preg_split('/[\\s]+/', $data);
     // create new language array of patterns
     $patterns = array();
     foreach ($patterns_array as $val) {
         if (!TCPDF_STATIC::empty_string($val)) {
             $val = trim($val);
             $val = str_replace('\'', '\\\'', $val);
             $key = preg_replace('/[0-9]+/', '', $val);
             $patterns[$key] = $val;
         }
     }
     return $patterns;
 }
开发者ID:risqiRPL,项目名称:iktrust-cabinet,代码行数:33,代码来源:tcpdf_static.php


示例7: showLibrariesInformation

 /**
  * show Libraries information in system information
  *
  * @since version 0.84
  **/
 static function showLibrariesInformation()
 {
     // No gettext
     echo "<tr class='tab_bg_2'><th>Libraries</th></tr>\n";
     echo "<tr class='tab_bg_1'><td><pre>\n&nbsp;\n";
     include_once GLPI_HTMLAWED;
     echo "htmLawed version " . hl_version() . " in (" . realpath(dirname(GLPI_HTMLAWED)) . ")\n";
     include GLPI_PHPCAS;
     echo "phpCas version " . phpCAS::getVersion() . " in (" . (dirname(GLPI_PHPCAS) ? realpath(dirname(GLPI_PHPCAS)) : "system") . ")\n";
     require_once GLPI_PHPMAILER_DIR . "/class.phpmailer.php";
     $pm = new PHPMailer();
     echo "PHPMailer version " . $pm->Version . " in (" . realpath(GLPI_PHPMAILER_DIR) . ")\n";
     // EZ component
     echo "ZetaComponent ezcGraph installed in (" . dirname(dirname(GLPI_EZC_BASE)) . "):  " . (class_exists('ezcGraph') ? 'OK' : 'KO') . "\n";
     // Zend
     $zv = new Zend\Version\Version();
     echo "Zend Framework version " . $zv::VERSION . " in (" . realpath(GLPI_ZEND_PATH) . ")\n";
     // SimplePie :
     $sp = new SimplePie();
     echo "SimplePie version " . SIMPLEPIE_VERSION . " in (" . realpath(GLPI_SIMPLEPIE_PATH) . ")\n";
     // TCPDF
     include_once GLPI_TCPDF_DIR . '/include/tcpdf_static.php';
     echo "TCPDF version " . TCPDF_STATIC::getTCPDFVersion() . " in (" . realpath(GLPI_TCPDF_DIR) . ")\n";
     // password_compat
     require_once GLPI_PASSWORD_COMPAT;
     $check = PasswordCompat\binary\check() ? "Ok" : "KO";
     echo "ircmaxell/password-compat in (" . realpath(dirname(GLPI_PASSWORD_COMPAT)) . "). Compatitility: {$check}\n";
     echo "\n</pre></td></tr>";
 }
开发者ID:UnidadInformaticaSERVIUVI,项目名称:Administrador-de-Inventario,代码行数:34,代码来源:config.class.php


示例8: foreach

 $doc->setHeaderFont(array($fontfamily, 'b', 10));
 $doc->setHeaderData('pix/moodlelogo-med.png', 40, $SITE->fullname, $CFG->wwwroot);
 $doc->setPrintFooter(true);
 $doc->setFooterMargin(10);
 $doc->setFooterFont(array($fontfamily, '', 8));
 $doc->AddPage();
 $doc->SetTextColor(255, 255, 255);
 $doc->SetFillColor(255, 203, 68);
 $doc->SetFont($fontfamily, 'B', 24);
 $doc->Cell(0, 0, 'Moodle PDF library test', 0, 1, 'C', 1);
 $doc->SetFont($fontfamily, '', 12);
 $doc->Ln(6);
 $doc->SetTextColor(0, 0, 0);
 $c = '<h3>General information</h3>';
 $c .= 'Moodle release: ' . $CFG->release . '<br />';
 $c .= 'PDF producer: TCPDF ' . TCPDF_STATIC::getTCPDFVersion() . ' (http://www.tcpdf.org) <br />';
 $c .= 'Font of this test page: ' . $fontfamily . '<br />';
 $c .= '<h3>Current settings</h3>';
 $c .= '<table border="1"  cellspacing="0" cellpadding="1">';
 foreach (array('K_PATH_MAIN', 'K_PATH_URL', 'K_PATH_FONTS', 'K_PATH_CACHE', 'K_PATH_IMAGES', 'K_BLANK_IMAGE', 'K_CELL_HEIGHT_RATIO', 'K_SMALL_RATIO', 'PDF_CUSTOM_FONT_PATH', 'PDF_DEFAULT_FONT') as $setting) {
     if (defined($setting)) {
         $c .= '<tr style="font-size: x-small;"><td>' . $setting . '</td><td>' . constant($setting) . '</td></tr>';
     }
 }
 $c .= '<tr  style="font-size: x-small;"><td>Effective font path</td><td>' . $doc->_getfontpath() . '</td></tr>';
 $c .= '</table><br />';
 $c .= '<h3>Available font files</h3>';
 $fontfiles = $doc->returnFontsList();
 sort($fontfiles);
 $c .= implode(', ', $fontfiles);
 $c .= '<br />';
开发者ID:abhilash1994,项目名称:moodle,代码行数:31,代码来源:pdflibtestpage.php


示例9: utf8Bidi

	/**
	 * Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/).
	 * @param $ta (array) array of characters composing the string.
	 * @param $str (string) string to process
	 * @param $forcertl (bool) if 'R' forces RTL, if 'L' forces LTR
	 * @param $isunicode (boolean) True if the document is in Unicode mode, false otherwise.
	 * @param $currentfont (array) Reference to current font array.
	 * @return array of unicode chars
	 * @author Nicola Asuni
	 * @since 2.4.000 (2008-03-06)
	 * @public static
	 */
	public static function utf8Bidi($ta, $str='', $forcertl=false, $isunicode=true, &$currentfont) {
		// paragraph embedding level
		$pel = 0;
		// max level
		$maxlevel = 0;
		if (TCPDF_STATIC::empty_string($str)) {
			// create string from array
			$str = self::UTF8ArrSubString($ta, '', '', $isunicode);
		}
		// check if string contains arabic text
		if (preg_match(TCPDF_FONT_DATA::$uni_RE_PATTERN_ARABIC, $str)) {
			$arabic = true;
		} else {
			$arabic = false;
		}
		// check if string contains RTL text
		if (!($forcertl OR $arabic OR preg_match(TCPDF_FONT_DATA::$uni_RE_PATTERN_RTL, $str))) {
			return $ta;
		}

		// get number of chars
		$numchars = count($ta);

		if ($forcertl == 'R') {
			$pel = 1;
		} elseif ($forcertl == 'L') {
			$pel = 0;
		} else {
			// P2. In each paragraph, find the first character of type L, AL, or R.
			// P3. If a character is found in P2 and it is of type AL or R, then set the paragraph embedding level to one; otherwise, set it to zero.
			for ($i=0; $i < $numchars; ++$i) {
				$type = TCPDF_FONT_DATA::$uni_type[$ta[$i]];
				if ($type == 'L') {
					$pel = 0;
					break;
				} elseif (($type == 'AL') OR ($type == 'R')) {
					$pel = 1;
					break;
				}
			}
		}

		// Current Embedding Level
		$cel = $pel;
		// directional override status
		$dos = 'N';
		$remember = array();
		// start-of-level-run
		$sor = $pel % 2 ? 'R' : 'L';
		$eor = $sor;

		// Array of characters data
		$chardata = Array();

		// X1. Begin by setting the current embedding level to the paragraph embedding level. Set the directional override status to neutral. Process each character iteratively, applying rules X2 through X9. Only embedding levels from 0 to 61 are valid in this phase.
		// In the resolution of levels in rules I1 and I2, the maximum embedding level of 62 can be reached.
		for ($i=0; $i < $numchars; ++$i) {
			if ($ta[$i] == TCPDF_FONT_DATA::$uni_RLE) {
				// X2. With each RLE, compute the least greater odd embedding level.
				//	a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to neutral.
				//	b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status.
				$next_level = $cel + ($cel % 2) + 1;
				if ($next_level < 62) {
					$remember[] = array('num' => TCPDF_FONT_DATA::$uni_RLE, 'cel' => $cel, 'dos' => $dos);
					$cel = $next_level;
					$dos = 'N';
					$sor = $eor;
					$eor = $cel % 2 ? 'R' : 'L';
				}
			} elseif ($ta[$i] == TCPDF_FONT_DATA::$uni_LRE) {
				// X3. With each LRE, compute the least greater even embedding level.
				//	a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to neutral.
				//	b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status.
				$next_level = $cel + 2 - ($cel % 2);
				if ( $next_level < 62 ) {
					$remember[] = array('num' => TCPDF_FONT_DATA::$uni_LRE, 'cel' => $cel, 'dos' => $dos);
					$cel = $next_level;
					$dos = 'N';
					$sor = $eor;
					$eor = $cel % 2 ? 'R' : 'L';
				}
			} elseif ($ta[$i] == TCPDF_FONT_DATA::$uni_RLO) {
				// X4. With each RLO, compute the least greater odd embedding level.
				//	a. If this new level would be valid, then this embedding code is valid. Remember (push) the current embedding level and override status. Reset the current level to this new level, and reset the override status to right-to-left.
				//	b. If the new level would not be valid, then this code is invalid. Do not change the current level or override status.
				$next_level = $cel + ($cel % 2) + 1;
				if ($next_level < 62) {
					$remember[] = array('num' => TCPDF_FONT_DATA::$uni_RLO, 'cel' => $cel, 'dos' => $dos);
//.........这里部分代码省略.........
开发者ID:elcharlygraf,项目名称:Encuesta-YiiFramework,代码行数:101,代码来源:tcpdf_fonts.php


示例10: getCellCode

 /**
  * Returns the PDF string code to print a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.<br />
  * If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
  * @param $w (float) Cell width. If 0, the cell extends up to the right margin.
  * @param $h (float) Cell height. Default value: 0.
  * @param $txt (string) String to print. Default value: empty string.
  * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul> or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
  * @param $ln (int) Indicates where the current position should go after the call. Possible values are:<ul><li>0: to the right (or left for RTL languages)</li><li>1: to the beginning of the next line</li><li>2: below</li></ul>Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.
  * @param $align (string) Allows to center or align the text. Possible values are:<ul><li>L or empty string: left align (default value)</li><li>C: center</li><li>R: right align</li><li>J: justify</li></ul>
  * @param $fill (boolean) Indicates if the cell background must be painted (true) or transparent (false).
  * @param $link (mixed) URL or identifier returned by AddLink().
  * @param $stretch (int) font stretch mode: <ul><li>0 = disabled</li><li>1 = horizontal scaling only if text is larger than cell width</li><li>2 = forced horizontal scaling to fit cell width</li><li>3 = character spacing only if text is larger than cell width</li><li>4 = forced character spacing to fit cell width</li></ul> General font stretching and scaling values will be preserved when possible.
  * @param $ignore_min_height (boolean) if true ignore automatic minimum height value.
  * @param $calign (string) cell vertical alignment relative to the specified Y value. Possible values are:<ul><li>T : cell top</li><li>C : center</li><li>B : cell bottom</li><li>A : font top</li><li>L : font baseline</li><li>D : font bottom</li></ul>
  * @param $valign (string) text vertical alignment inside the cell. Possible values are:<ul><li>T : top</li><li>M : middle</li><li>B : bottom</li></ul>
  * @return string containing cell code
  * @protected
  * @since 1.0
  * @see Cell()
  */
 protected function getCellCode($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M')
 {
     // replace 'NO-BREAK SPACE' (U+00A0) character with a simple space
     $txt = str_replace(TCPDF_FONTS::unichr(160, $this->isunicode), ' ', $txt);
     $prev_cell_margin = $this->cell_margin;
     $prev_cell_padding = $this->cell_padding;
     $txt = TCPDF_STATIC::removeSHY($txt, $this->isunicode);
     $rs = '';
     //string to be returned
     $this->adjustCellPadding($border);
     if (!$ignore_min_height) {
         $min_cell_height = $this->getCellHeight($this->FontSize);
         if ($h < $min_cell_height) {
             $h = $min_cell_height;
         }
     }
     $k = $this->k;
     // check page for no-write regions and adapt page margins if necessary
     list($this->x, $this->y) = $this->checkPageRegions($h, $this->x, $this->y);
     if ($this->rtl) {
         $x = $this->x - $this->cell_margin['R'];
     } else {
         $x = $this->x + $this->cell_margin['L'];
     }
     $y = $this->y + $this->cell_margin['T'];
     $prev_font_stretching = $this->font_stretching;
     $prev_font_spacing = $this->font_spacing;
     // cell vertical alignment
     switch ($calign) {
         case 'A':
             // font top
             switch ($valign) {
                 case 'T':
                     // top
                     $y -= $this->cell_padding['T'];
                     break;
                 case 'B':
                     // bottom
                     $y -= $h - $this->cell_padding['B'] - $this->FontAscent - $this->FontDescent;
                     break;
                 default:
                 case 'C':
                 case 'M':
                     // center
                     $y -= ($h - $this->FontAscent - $this->FontDescent) / 2;
                     break;
             }
             break;
         case 'L':
             // font baseline
             switch ($valign) {
                 case 'T':
                     // top
                     $y -= $this->cell_padding['T'] + $this->FontAscent;
                     break;
                 case 'B':
                     // bottom
                     $y -= $h - $this->cell_padding['B'] - $this->FontDescent;
                     break;
                 default:
                 case 'C':
                 case 'M':
                     // center
                     $y -= ($h + $this->FontAscent - $this->FontDescent) / 2;
                     break;
             }
             break;
         case 'D':
             // font bottom
             switch ($valign) {
                 case 'T':
                     // top
                     $y -= $this->cell_padding['T'] + $this->FontAscent + $this->FontDescent;
                     break;
                 case 'B':
                     // bottom
                     $y -= $h - $this->cell_padding['B'];
                     break;
                 default:
                 case 'C':
//.........这里部分代码省略.........
开发者ID:bochniak,项目名称:lms-1,代码行数:101,代码来源:tcpdf.php


示例11: renderRow

 protected function renderRow($x, $y, $row, $options, &$view = NULL, $key = NULL, $printLabels = TRUE)
 {
     $pageDim = $this->getPageDimensions();
     // Render the content if it is not already:
     if (is_object($view) && $key != NULL && isset($view->field[$key]) && is_object($view->field[$key]) && !is_string($row)) {
         $content = $view->field[$key]->theme($row);
     } elseif (is_string($row)) {
         $content = $row;
     } else {
         // We got bad data. So return.
         return;
     }
     if (empty($key) || !empty($view->field[$key]->options['exclude']) || empty($content) && $view->field[$key]->options['hide_empty']) {
         return '';
     }
     // Apply the hyphenation patterns to the content:
     if (!isset($options['text']['hyphenate']) && is_object($view) && is_object($view->display_handler)) {
         $options['text']['hyphenate'] = $view->display_handler->get_option('default_text_hyphenate');
     }
     if (isset($options['text']['hyphenate']) && $options['text']['hyphenate'] != 'none') {
         $patternFile = $options['text']['hyphenate'];
         if ($options['text']['hyphenate'] == 'auto' && is_object($row)) {
             // Workaround:
             // Since "$nodeLanguage = $row->node_language;" does not work anymore,
             // we using this:
             if (isset($row->_field_data['nid']['entity']->language)) {
                 $nodeLanguage = $row->_field_data['nid']['entity']->language;
                 foreach (self::getAvailableHyphenatePatterns() as $file => $pattern) {
                     if (stristr($pattern, $nodeLanguage) !== FALSE) {
                         $patternFile = $file;
                         break;
                     }
                 }
             }
         }
         $patternFile = views_pdf_get_library('tcpdf') . '/hyphenate_patterns/' . $patternFile;
         if (file_exists($patternFile)) {
             if (method_exists('TCPDF_STATIC', 'getHyphenPatternsFromTEX')) {
                 $hyphen_patterns = TCPDF_STATIC::getHyphenPatternsFromTEX($patternFile);
             } else {
                 $hyphen_patterns = $this->getHyphenPatternsFromTEX($patternFile);
             }
             // Bugfix if you like to print some html code to the PDF, we
             // need to prevent the replacement of this tags.
             $content = str_replace('&gt;', '&amp;gt;', $content);
             $content = str_replace('&lt;', '&amp;lt;', $content);
             $content = $this->hyphenateText($content, $hyphen_patterns);
         }
     }
     // Set css variable
     if (is_object($view) && is_object($view->display_handler)) {
         $css_file = $view->display_handler->get_option('css_file');
     }
     // Render Labels
     $prefix = '';
     if ($printLabels && !empty($view->field[$key]->options['label'])) {
         $prefix = $view->field[$key]->options['label'];
         if ($view->field[$key]->options['element_label_colon']) {
             $prefix .= ':';
         }
         $prefix .= ' ';
     }
     $font_size = empty($options['text']['font_size']) ? $this->defaultFontSize : $options['text']['font_size'];
     $font_family = $options['text']['font_family'] == 'default' || empty($options['text']['font_family']) ? $this->defaultFontFamily : $options['text']['font_family'];
     $font_style = is_array($options['text']['font_style']) ? $options['text']['font_style'] : $this->defaultFontStyle;
     $textColor = !empty($options['text']['color']) ? $this->parseColor($options['text']['color']) : $this->parseColor($this->defaultFontColor);
     $w = $options['position']['width'];
     $h = $options['position']['height'];
     $border = 0;
     $align = isset($options['text']['align']) ? $options['text']['align'] : $this->defaultTextAlign;
     $fill = 0;
     $ln = 1;
     $reseth = TRUE;
     $stretch = 0;
     $ishtml = isset($options['render']['is_html']) ? $options['render']['is_html'] : 1;
     $stripHTML = !$ishtml;
     $autopadding = TRUE;
     $maxh = 0;
     $valign = 'T';
     $fitcell = FALSE;
     // Run eval before.
     if (!empty($options['render']['bypass_eval_before']) && !empty($options['render']['eval_before'])) {
         eval($options['render']['eval_before']);
     } elseif (!empty($options['render']['eval_before'])) {
         $content = php_eval($options['render']['eval_before']);
     }
     // Add css if there is a css file set and stripHTML is not active.
     if (!empty($css_file) && is_string($css_file) && !$stripHTML && $ishtml && !empty($content)) {
         $content = '<link type="text/css" rel="stylesheet" media="all" href="' . $css_file . '" />' . PHP_EOL . $content;
     }
     // Set Text Color.
     $this->SetTextColorArray($textColor);
     // Set font.
     $this->SetFont($font_family, implode('', $font_style), $font_size);
     // Save the last page before starting writing, this
     // is needed to dected if we write over a page. Then we need
     // to reset the y coordinate for the 'last_writing' position option.
     $this->lastWritingPage = $this->getPage();
     if ($stripHTML) {
         $content = strip_tags($content);
//.........这里部分代码省略.........
开发者ID:kastowo,项目名称:idbigdata,代码行数:101,代码来源:views_pdf_template.php


示例12: serializeTCPDFtagParameters

For security reasons, the parameters for the 'params' attribute of TCPDF
tag must be prepared as an array and encoded with the
serializeTCPDFtagParameters() method (see the example below).

 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
$html = '<h1>Test TCPDF Methods in HTML</h1>
<h2 style="color:red;">IMPORTANT:</h2>
<span style="color:red;">If you are using user-generated content, the tcpdf tag can be unsafe.<br />
You can disable this tag by setting to false the <b>K_TCPDF_CALLS_IN_HTML</b> constant on TCPDF configuration file.</span>
<h2>write1DBarcode method in HTML</h2>';
$params = TCPDF_STATIC::serializeTCPDFtagParameters(array('CODE 39', 'C39', '', '', 80, 30, 0.4, array('position' => 'S', 'border' => true, 'padding' => 4, 'fgcolor' => array(0, 0, 0), 'bgcolor' => array(255, 255, 255), 'text' => true, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4), 'N'));
$html .= '<tcpdf method="write1DBarcode" params="' . $params . '" />';
$params = TCPDF_STATIC::serializeTCPDFtagParameters(array('CODE 128', 'C128', '', '', 80, 30, 0.4, array('position' => 'S', 'border' => true, 'padding' => 4, 'fgcolor' => array(0, 0, 0), 'bgcolor' => array(255, 255, 255), 'text' => true, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4), 'N'));
$html .= '<tcpdf method="write1DBarcode" params="' . $params . '" />';
$html .= '<tcpdf method="AddPage" /><h2>Graphic Functions</h2>';
$params = TCPDF_STATIC::serializeTCPDFtagParameters(array(0));
$html .= '<tcpdf method="SetDrawColor" params="' . $params . '" />';
$params = TCPDF_STATIC::serializeTCPDFtagParameters(array(50, 50, 40, 10, 'DF', array(), array(0, 128, 255)));
$html .= '<tcpdf method="Rect" params="' . $params . '" />';
// output the HTML content
$pdf->writeHTML($html, true, 0, true, 0);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// reset pointer to the last page
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_049.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
开发者ID:zqstudio2015,项目名称:smeoa,代码行数:30,代码来源:example_049.php


示例13: pdf_write_value

 /**
  * Writes a value
  * Needed to rebuild the source document
  *
  * @param mixed $value A PDF-Value. Structure of values see cases in this method
  */
 function pdf_write_value(&$value)
 {
     switch ($value[0]) {
         case PDF_TYPE_STRING:
             if ($this->encrypted) {
                 $value[1] = $this->_unescape($value[1]);
                 $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]);
                 $value[1] = TCPDF_STATIC::_escape($value[1]);
             }
             break;
         case PDF_TYPE_STREAM:
             if ($this->encrypted) {
                 $value[2][1] = $this->_encrypt_data($this->_current_obj_id, $value[2][1]);
                 $value[1][1]['/Length'] = array(PDF_TYPE_NUMERIC, strlen($value[2][1]));
             }
             break;
         case PDF_TYPE_HEX:
             if ($this->encrypted) {
                 $value[1] = $this->hex2str($value[1]);
                 $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]);
                 // remake hexstring of encrypted string
                 $value[1] = $this->str2hex($value[1]);
             }
             break;
     }
     switch ($value[0]) {
         case PDF_TYPE_TOKEN:
             $this->_straightOut('/' . $value[1] . ' ');
             break;
         case PDF_TYPE_NUMERIC:
         case PDF_TYPE_REAL:
             if (is_float($value[1]) && $value[1] != 0) {
                 $this->_straightOut(rtrim(rtrim(sprintf('%F', $value[1]), '0'), '.') . ' ');
             } else {
                 $this->_straightOut($value[1] . ' ');
             }
             break;
         case PDF_TYPE_ARRAY:
             // An array. Output the proper
             // structure and move on.
             $this->_straightOut('[');
             for ($i = 0; $i < count($value[1]); $i++) {
                 $this->pdf_write_value($value[1][$i]);
             }
             $this->_out(']');
             break;
         case PDF_TYPE_DICTIONARY:
             // A dictionary.
             $this->_straightOut('<<');
             reset($value[1]);
             while (list($k, $v) = each($value[1])) {
                 $this->_straightOut($k . ' ');
                 $this->pdf_write_value($v);
             }
             $this->_straightOut('>>');
             break;
         case PDF_TYPE_OBJREF:
             // An indirect object reference
             // Fill the object stack if needed
             $cpfn =& $this->current_parser->uniqueid;
             if (!isset($this->_don_obj_stack[$cpfn][$value[1]])) {
                 $this->_newobj(false, true);
                 $this->_obj_stack[$cpfn][$value[1]] = array($this->n, $value);
                 $this->_don_obj_stack[$cpfn][$value[1]] = array($this->n, $value);
                 // Value is maybee obsolete!!!
             }
             $objid = $this->_don_obj_stack[$cpfn][$value[1]][0];
             $this->_out($objid . ' 0 R');
             break;
         case PDF_TYPE_STRING:
             // A string.
             $this->_straightOut('(' . $value[1] . ')');
             break;
         case PDF_TYPE_STREAM:
             // A stream. First, output the
             // stream dictionary, then the
             // stream data itself.
             $this->pdf_write_value($value[1]);
             $this->_out('stream');
             $this->_out($value[2][1]);
             $this->_out('endstream');
             break;
         case PDF_TYPE_HEX:
             $this->_straightOut('<' . $value[1] . '>');
             break;
         case PDF_TYPE_BOOLEAN:
             $this->_straightOut($value[1] ? 'true ' : 'false ');
             break;
         case PDF_TYPE_NULL:
             // The null object.
             $this->_straightOut('null ');
             break;
     }
 }
开发者ID:LynX39,项目名称:lara-pdf-merger,代码行数:100,代码来源:tcpdi.php


示例14: Output

 /**
  * Overriden to allow unicode in filenames
  * @see http://sourceforge.net/p/tcpdf/feature-requests/184/
  *
  * Send the document to a given destination: string, local file or browser.
  * In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.<br />
  * The method first calls Close() if necessary to terminate the document.
  * @param $name (string) The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character.
  * @param $dest (string) Destination where to send the document. It can take one of the following values:<ul><li>I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.</li><li>D: send to the browser and force a file download with the name given by name.</li><li>F: save to a local server file with the name given by name.</li><li>S: return the document as a string (name is ignored).</li><li>FI: equivalent to F + I option</li><li>FD: equivalent to F + D option</li><li>E: return the document as base64 mime multi-part email attachment (RFC 2045)</li></ul>
  * @public
  * @since 1.0
  * @see Close()
  */
 public function Output($name = 'doc.pdf', $dest = 'I')
 {
     //Output PDF to some destination
     //Finish document if necessary
     if ($this->state < 3) {
         $this->Close();
     }
     //Normalize parameters
     if (is_bool($dest)) {
         $dest = $dest ? 'D' : 'F';
     }
     $dest = strtoupper($dest);
     if ($dest[0] != 'F') {
         $name = preg_replace('/[\\s]+/', '_', $name);
         $name = preg_replace('/[^\\p{L}\\p{N}_\\.-]/u', '', $name);
     }
     if ($this->sign) {
         // *** apply digital signature to the document ***
         // get the document content
         $pdfdoc = $this->getBuffer();
         // remove last newline
         $pdfdoc = substr($pdfdoc, 0, -1);
         // Remove the original buffer
         if (isset($this->diskcache) and $this->diskcache) {
             // remove buffer file from cache
             unlink($this->buffer);
         }
         unset($this->buffer);
         // remove filler space
         $byterange_string_len = strlen(TCPDF_STATIC::$byterange_string);
         // define the ByteRange
         $byte_range = array();
         $byte_range[0] = 0;
         $byte_range[1] = strpos($pdfdoc, TCPDF_STATIC::$byterange_string) + $byterange_string_len + 10;
         $byte_range[2] = $byte_range[1] + $this->signature_max_length + 2;
         $byte_range[3] = strlen($pdfdoc) - $byte_range[2];
         $pdfdoc = substr($pdfdoc, 0, $byte_range[1]) . substr($pdfdoc, $byte_range[2]);
         // replace the ByteRange
         $byterange = sprintf('/ByteRange[0 %u %u %u]', $byte_range[1], $byte_range[2], $byte_range[3]);
         $byterange .= str_repeat(' ', $byterange_string_len - strlen($byterange));
         $pdfdoc = str_replace(TCPDF_STATIC::$byterange_string, $byterange, $pdfdoc);
         // write the document to a temporary folder
         $tempdoc = TCPDF_STATIC::getObjFilename('doc');
         $f = fopen($tempdoc, 'wb');
         if (!$f) {
             $this->Error('Unable to create temporary file: ' . $tempdoc);
         }
         $pdfdoc_length = strlen($pdfdoc);
         fwrite($f, $pdfdoc, $pdfdoc_length);
         fclose($f);
         // get digital signature via openssl library
         $tempsign = TCPDF_STATIC::getObjFilename('sig');
         if (empty($this->signature_data['extracerts'])) {
             openssl_pkcs7_sign($tempdoc, $tempsign, $this->signature_data['signcert'], array($this->signature_data['privkey'], $this->signature_data['password']), array(), PKCS7_BINARY | PKCS7_DETACHED);
         } else {
             openssl_pkcs7_sign($tempdoc, $tempsign, $this->signature_data['signcert'], array($this->signature_data['privkey'], $this->signature_data['password']), array(), PKCS7_BINARY | PKCS7_DETACHED, $this->signature_data['extracerts']);
         }
         unlink($tempdoc);
         // read signature
         $signature = file_get_contents($tempsign);
         unlink($tempsign);
         // extract signature
         $signature = substr 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP TC_utils类代码示例发布时间:2022-05-23
下一篇:
PHP TCPDF_IMAGES类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap