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

PHP Zend_Pdf_Element_String类代码示例

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

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



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

示例1: testUnescapeOctal

 /**
  * @group ZF-9450
  */
 public function testUnescapeOctal()
 {
     $input = array(0304 => '\\304', 0326 => '\\326', 0334 => '\\334');
     foreach ($input as $k => $v) {
         $this->assertEquals(Zend_Pdf_Element_String::unescape($v), chr($k), 'expected German Umlaut');
     }
 }
开发者ID:netvlies,项目名称:zf,代码行数:10,代码来源:StringTest.php


示例2: drawText

 /**
  * Draw a line of text at the specified position.
  *
  * @param string $text
  * @param float $x
  * @param float $y
  * @param string $charEncoding (optional) Character encoding of source text.
  *   Defaults to current locale.
  * @throws Zend_Pdf_Exception
  * @return Zend_Pdf_Page
  */
 public function drawText($text, $x, $y, $charEncoding = '')
 {
     if ($this->_font === null) {
         //require_once 'Zend/Pdf/Exception.php';
         throw new Zend_Pdf_Exception('Font has not been set');
     }
     $this->_addProcSet('Text');
     $textObj = new Zend_Pdf_Element_String($this->_font->encodeString($text, $charEncoding));
     $xObj = new Zend_Pdf_Element_Numeric($x);
     $yObj = new Zend_Pdf_Element_Numeric($y);
     $this->_contents .= "BT\n" . $xObj->toString() . ' ' . $yObj->toString() . " Td\n" . $textObj->toString() . " Tj\n" . "ET\n";
     return $this;
 }
开发者ID:chaimvaid,项目名称:linet3,代码行数:24,代码来源:Page.php


示例3: _readString

 /**
  * Read string PDF object
  * Also reads trailing ')' from a pdf stream
  *
  * @return Zend_Pdf_Element_String
  * @throws Zend_Pdf_Exception
  */
 private function _readString()
 {
     $start = $this->offset;
     $openedBrackets = 1;
     $this->offset += strcspn($this->data, '()\\', $this->offset);
     while ($this->offset < strlen($this->data)) {
         switch (ord($this->data[$this->offset])) {
             case 0x28:
                 // '(' - opened bracket in the string, needs balanced pair.
                 $this->offset++;
                 $openedBrackets++;
                 break;
             case 0x29:
                 // ')' - pair to the opened bracket
                 $this->offset++;
                 $openedBrackets--;
                 break;
             case 0x5c:
                 // '\\' - escape sequence, skip next char from a check
                 $this->offset += 2;
         }
         if ($openedBrackets == 0) {
             break;
             // end of string
         }
         $this->offset += strcspn($this->data, '()\\', $this->offset);
     }
     if ($openedBrackets != 0) {
         require_once 'Zend/Pdf/Exception.php';
         throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected end of file while string reading. Offset - 0x%X. \')\' expected.', $start));
     }
     return new Zend_Pdf_Element_String(Zend_Pdf_Element_String::unescape(substr($this->data, $start, $this->offset - $start - 1)));
 }
开发者ID:travisj,项目名称:zf,代码行数:40,代码来源:StringParser.php


示例4: drawText

 /**
  * Draw a line of text at the specified position.
  *
  * @param string $text
  * @param float $x
  * @param float $y
  * @throws Zend_Pdf_Exception
  */
 public function drawText($text, $x, $y)
 {
     if ($this->_font === null) {
         throw new Zend_Pdf_Exception('Font has not been set');
     }
     $this->_addProcSet('Text');
     $textObj = new Zend_Pdf_Element_String($text);
     $xObj = new Zend_Pdf_Element_Numeric($x);
     $yObj = new Zend_Pdf_Element_Numeric($y);
     $this->_contents .= "BT\n" . $xObj->toString() . ' ' . $yObj->toString() . " Td\n" . $textObj->toString() . " Tj\n" . "ET\n";
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:19,代码来源:Page.php


示例5: testUnescape

 public function testUnescape()
 {
     $this->assertEquals(Zend_Pdf_Element_String::unescape("\\n\\r\\t\\b\\f\\(\\)\\\\  \nsome \\\ntext"), "\n\r\t\f()\\  \nsome text");
 }
开发者ID:lortnus,项目名称:zf1,代码行数:4,代码来源:StringTest.php


示例6: _readString

 /**
  * Read string PDF object
  * Also reads trailing ')' from a pdf stream
  *
  * @return Zend_Pdf_Element_String
  * @throws Zend_Pdf_Exception
  */
 private function _readString()
 {
     $start = $this->_current;
     $openedBrackets = 1;
     while ($this->_current < strlen($this->_pdfString)) {
         switch (ord($this->_pdfString[$this->_current])) {
             case 0x28:
                 // '(' - opened bracket in the string, needs balanced pair.
                 $openedBrackets++;
                 break;
             case 0x29:
                 // ')' - pair to the opened bracket
                 $openedBrackets--;
                 break;
             case 0x5c:
                 // '\\' - escape sequence, skip next char from a check
                 $this->_current++;
         }
         $this->_current++;
         if ($openedBrackets == 0) {
             break;
             // end of string
         }
     }
     if ($openedBrackets != 0) {
         throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected end of file while string reading. Offset - 0x%X. \')\' expected.', $start));
     }
     return new Zend_Pdf_Element_String(Zend_Pdf_Element_String::unescape(substr($this->_pdfString, $start, $this->_current - $start - 1)));
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:36,代码来源:Parser.php


示例7: _readString

 private function _readString()
 {
     $start = $this->offset;
     $openedBrackets = 1;
     $this->offset += strcspn($this->data, '()\\', $this->offset);
     while ($this->offset < strlen($this->data)) {
         switch (ord($this->data[$this->offset])) {
             case 0x28:
                 $this->offset++;
                 $openedBrackets++;
                 break;
             case 0x29:
                 $this->offset++;
                 $openedBrackets--;
                 break;
             case 0x5c:
                 $this->offset += 2;
         }
         if ($openedBrackets == 0) {
             break;
         }
         $this->offset += strcspn($this->data, '()\\', $this->offset);
     }
     if ($openedBrackets != 0) {
         throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected end of file while string reading. Offset - 0x%X. \')\' expected.', $start));
     }
     return new Zend_Pdf_Element_String(Zend_Pdf_Element_String::unescape(substr($this->data, $start, $this->offset - $start - 1)));
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:28,代码来源:Pdf_Pack.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Pdf_FileParser_Font_OpenType类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Pdf_Element_Reference_Table类代码示例发布时间: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