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


PHP TCPDF_STATIC::replacePageNumAliases方法代码示例

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


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

示例1: _putpages

 /**
  * Output pages (and replace page number aliases).
  * @protected
  */
 protected function _putpages()
 {
     $filter = $this->compress ? '/Filter /FlateDecode ' : '';
     // get internal aliases for page numbers
     $pnalias = $this->getAllInternalPageNumberAliases();
     $num_pages = $this->numpages;
     $ptpa = TCPDF_STATIC::formatPageNumber($this->starting_page_number + $num_pages - 1);
     $ptpu = TCPDF_FONTS::UTF8ToUTF16BE($ptpa, false, $this->isunicode, $this->CurrentFont);
     $ptp_num_chars = $this->GetNumChars($ptpa);
     $pagegroupnum = 0;
     $groupnum = 0;
     $ptgu = 1;
     $ptga = 1;
     $ptg_num_chars = 1;
     for ($n = 1; $n <= $num_pages; ++$n) {
         // get current page
         $temppage = $this->getPageBuffer($n);
         $pagelen = strlen($temppage);
         // set replacements for total pages number
         $pnpa = TCPDF_STATIC::formatPageNumber($this->starting_page_number + $n - 1);
         $pnpu = TCPDF_FONTS::UTF8ToUTF16BE($pnpa, false, $this->isunicode, $this->CurrentFont);
         $pnp_num_chars = $this->GetNumChars($pnpa);
         $pdiff = 0;
         // difference used for right shift alignment of page numbers
         $gdiff = 0;
         // difference used for right shift alignment of page group numbers
         if (!empty($this->pagegroups)) {
             if (isset($this->newpagegroup[$n])) {
                 $pagegroupnum = 0;
                 ++$groupnum;
                 $ptga = TCPDF_STATIC::formatPageNumber($this->pagegroups[$groupnum]);
                 $ptgu = TCPDF_FONTS::UTF8ToUTF16BE($ptga, false, $this->isunicode, $this->CurrentFont);
                 $ptg_num_chars = $this->GetNumChars($ptga);
             }
             ++$pagegroupnum;
             $pnga = TCPDF_STATIC::formatPageNumber($pagegroupnum);
             $pngu = TCPDF_FONTS::UTF8ToUTF16BE($pnga, false, $this->isunicode, $this->CurrentFont);
             $png_num_chars = $this->GetNumChars($pnga);
             // replace page numbers
             $replace = array();
             $replace[] = array($ptgu, $ptg_num_chars, 9, $pnalias[2]['u']);
             $replace[] = array($ptga, $ptg_num_chars, 7, $pnalias[2]['a']);
             $replace[] = array($pngu, $png_num_chars, 9, $pnalias[3]['u']);
             $replace[] = array($pnga, $png_num_chars, 7, $pnalias[3]['a']);
             list($temppage, $gdiff) = TCPDF_STATIC::replacePageNumAliases($temppage, $replace, $gdiff);
         }
         // replace page numbers
         $replace = array();
         $replace[] = array($ptpu, $ptp_num_chars, 9, $pnalias[0]['u']);
         $replace[] = array($ptpa, $ptp_num_chars, 7, $pnalias[0]['a']);
         $replace[] = array($pnpu, $pnp_num_chars, 9, $pnalias[1]['u']);
         $replace[] = array($pnpa, $pnp_num_chars, 7, $pnalias[1]['a']);
         list($temppage, $pdiff) = TCPDF_STATIC::replacePageNumAliases($temppage, $replace, $pdiff);
         // replace right shift alias
         $temppage = $this->replaceRightShiftPageNumAliases($temppage, $pnalias[4], max($pdiff, $gdiff));
         // replace EPS marker
         $temppage = str_replace($this->epsmarker, '', $temppage);
         //Page
         $this->page_obj_id[$n] = $this->_newobj();
         $out = '<<';
         $out .= ' /Type /Page';
         $out .= ' /Parent 1 0 R';
         $out .= ' /LastModified ' . $this->_datestring(0, $this->doc_modification_timestamp);
         $out .= ' /Resources 2 0 R';
         foreach ($this->page_boxes as $box) {
             $out .= ' /' . $box;
             $out .= sprintf(' [%F %F %F %F]', $this->pagedim[$n][$box]['llx'], $this->pagedim[$n][$box]['lly'], $this->pagedim[$n][$box]['urx'], $this->pagedim[$n][$box]['ury']);
         }
         if (isset($this->pagedim[$n]['BoxColorInfo']) and !empty($this->pagedim[$n]['BoxColorInfo'])) {
             $out .= ' /BoxColorInfo <<';
             foreach ($this->page_boxes as $box) {
                 if (isset($this->pagedim[$n]['BoxColorInfo'][$box])) {
                     $out .= ' /' . $box . ' <<';
                     if (isset($this->pagedim[$n]['BoxColorInfo'][$box]['C'])) {
                         $color = $this->pagedim[$n]['BoxColorInfo'][$box]['C'];
                         $out .= ' /C [';
                         $out .= sprintf(' %F %F %F', $color[0] / 255, $color[1] / 255, $color[2] / 255);
                         $out .= ' ]';
                     }
                     if (isset($this->pagedim[$n]['BoxColorInfo'][$box]['W'])) {
                         $out .= ' /W ' . $this->pagedim[$n]['BoxColorInfo'][$box]['W'] * $this->k;
                     }
                     if (isset($this->pagedim[$n]['BoxColorInfo'][$box]['S'])) {
                         $out .= ' /S /' . $this->pagedim[$n]['BoxColorInfo'][$box]['S'];
                     }
                     if (isset($this->pagedim[$n]['BoxColorInfo'][$box]['D'])) {
                         $dashes = $this->pagedim[$n]['BoxColorInfo'][$box]['D'];
                         $out .= ' /D [';
                         foreach ($dashes as $dash) {
                             $out .= sprintf(' %F', $dash * $this->k);
                         }
                         $out .= ' ]';
                     }
                     $out .= ' >>';
                 }
             }
//.........这里部分代码省略.........
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:101,代码来源:tcpdf.php


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