当前位置: 首页>>代码示例>>PHP>>正文


PHP TCPDF_STATIC::encodeNameObject方法代码示例

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


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

示例1: _putbookmarks

 /**
  * Create a bookmark PDF string.
  * @protected
  * @author Olivier Plathey, Nicola Asuni
  * @since 2.1.002 (2008-02-12)
  */
 protected function _putbookmarks()
 {
     $nb = count($this->outlines);
     if ($nb == 0) {
         return;
     }
     // sort bookmarks
     $this->sortBookmarks();
     $lru = array();
     $level = 0;
     foreach ($this->outlines as $i => $o) {
         if ($o['l'] > 0) {
             $parent = $lru[$o['l'] - 1];
             //Set parent and last pointers
             $this->outlines[$i]['parent'] = $parent;
             $this->outlines[$parent]['last'] = $i;
             if ($o['l'] > $level) {
                 //Level increasing: set first pointer
                 $this->outlines[$parent]['first'] = $i;
             }
         } else {
             $this->outlines[$i]['parent'] = $nb;
         }
         if ($o['l'] <= $level and $i > 0) {
             //Set prev and next pointers
             $prev = $lru[$o['l']];
             $this->outlines[$prev]['next'] = $i;
             $this->outlines[$i]['prev'] = $prev;
         }
         $lru[$o['l']] = $i;
         $level = $o['l'];
     }
     //Outline items
     $n = $this->n + 1;
     $nltags = '/<br[\\s]?\\/>|<\\/(blockquote|dd|dl|div|dt|h1|h2|h3|h4|h5|h6|hr|li|ol|p|pre|ul|tcpdf|table|tr|td)>/si';
     foreach ($this->outlines as $i => $o) {
         $oid = $this->_newobj();
         // covert HTML title to string
         $title = preg_replace($nltags, "\n", $o['t']);
         $title = preg_replace("/[\r]+/si", '', $title);
         $title = preg_replace("/[\n]+/si", "\n", $title);
         $title = strip_tags($title);
         $title = $this->stringTrim($title);
         $out = '<</Title ' . $this->_textstring($title, $oid);
         $out .= ' /Parent ' . ($n + $o['parent']) . ' 0 R';
         if (isset($o['prev'])) {
             $out .= ' /Prev ' . ($n + $o['prev']) . ' 0 R';
         }
         if (isset($o['next'])) {
             $out .= ' /Next ' . ($n + $o['next']) . ' 0 R';
         }
         if (isset($o['first'])) {
             $out .= ' /First ' . ($n + $o['first']) . ' 0 R';
         }
         if (isset($o['last'])) {
             $out .= ' /Last ' . ($n + $o['last']) . ' 0 R';
         }
         if (isset($o['u']) and !empty($o['u'])) {
             // link
             if (is_string($o['u'])) {
                 if ($o['u'][0] == '#') {
                     // internal destination
                     $out .= ' /Dest /' . TCPDF_STATIC::encodeNameObject(substr($o['u'], 1));
                 } elseif ($o['u'][0] == '%') {
                     // embedded PDF file
                     $filename = basename(substr($o['u'], 1));
                     $out .= ' /A <</S /GoToE /D [0 /Fit] /NewWindow true /T << /R /C /P ' . ($o['p'] - 1) . ' /A ' . $this->embeddedfiles[$filename]['a'] . ' >> >>';
                 } elseif ($o['u'][0] == '*') {
                     // embedded generic file
                     $filename = basename(substr($o['u'], 1));
                     $jsa = 'var D=event.target.doc;var MyData=D.dataObjects;for (var i in MyData) if (MyData[i].path=="' . $filename . '") D.exportDataObject( { cName : MyData[i].name, nLaunch : 2});';
                     $out .= ' /A <</S /JavaScript /JS ' . $this->_textstring($jsa, $oid) . '>>';
                 } else {
                     // external URI link
                     $out .= ' /A <</S /URI /URI ' . $this->_datastring($this->unhtmlentities($o['u']), $oid) . '>>';
                 }
             } elseif (isset($this->links[$o['u']])) {
                 // internal link ID
                 $l = $this->links[$o['u']];
                 if (isset($this->page_obj_id[$l[0]])) {
                     $out .= sprintf(' /Dest [%u 0 R /XYZ 0 %F null]', $this->page_obj_id[$l[0]], $this->pagedim[$l[0]]['h'] - $l[1] * $this->k);
                 }
             }
         } elseif (isset($this->page_obj_id[$o['p']])) {
             // link to a page
             $out .= ' ' . sprintf('/Dest [%u 0 R /XYZ %F %F null]', $this->page_obj_id[$o['p']], $o['x'] * $this->k, $this->pagedim[$o['p']]['h'] - $o['y'] * $this->k);
         }
         // set font style
         $style = 0;
         if (!empty($o['s'])) {
             // bold
             if (strpos($o['s'], 'B') !== false) {
                 $style |= 2;
             }
//.........这里部分代码省略.........
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:101,代码来源:tcpdf.php


注:本文中的TCPDF_STATIC::encodeNameObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。