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


PHP TCPDF_STATIC::sendOutputData方法代码示例

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


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

示例1: Output


//.........这里部分代码省略.........
         $tmparr = explode("\n\n", $signature);
         $signature = $tmparr[1];
         unset($tmparr);
         // decode signature
         $signature = base64_decode(trim($signature));
         // convert signature to hex
         $signature = current(unpack('H*', $signature));
         $signature = str_pad($signature, $this->signature_max_length, '0');
         // disable disk caching
         $this->diskcache = false;
         // Add signature to the document
         $this->buffer = substr($pdfdoc, 0, $byte_range[1]) . '<' . $signature . '>' . substr($pdfdoc, $byte_range[1]);
         $this->bufferlen = strlen($this->buffer);
     }
     switch ($dest) {
         case 'I':
             // Send PDF to the standard output
             if (ob_get_contents()) {
                 $this->Error('Some data has already been output, can\'t send PDF file');
             }
             if (php_sapi_name() != 'cli') {
                 // send output to a browser
                 header('Content-Type: application/pdf');
                 if (headers_sent()) {
                     $this->Error('Some data has already been output to browser, can\'t send PDF file');
                 }
                 header('Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1');
                 //header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
                 header('Pragma: public');
                 header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
                 // Date in the past
                 header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
                 header('Content-Disposition: inline; filename="' . basename($name) . '"');
                 TCPDF_STATIC::sendOutputData($this->getBuffer(), $this->bufferlen);
             } else {
                 echo $this->getBuffer();
             }
             break;
         case 'D':
             // download PDF as file
             if (ob_get_contents()) {
                 $this->Error('Some data has already been output, can\'t send PDF file');
             }
             header('Content-Description: File Transfer');
             if (headers_sent()) {
                 $this->Error('Some data has already been output to browser, can\'t send PDF file');
             }
             header('Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1');
             //header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
             header('Pragma: public');
             header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
             // Date in the past
             header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
             // force download dialog
             if (strpos(php_sapi_name(), 'cgi') === false) {
                 header('Content-Type: application/force-download');
                 header('Content-Type: application/octet-stream', false);
                 header('Content-Type: application/download', false);
                 header('Content-Type: application/pdf', false);
             } else {
                 header('Content-Type: application/pdf');
             }
             // use the Content-Disposition header to supply a recommended filename
             header('Content-Disposition: attachment; filename="' . basename($name) . '"');
             header('Content-Transfer-Encoding: binary');
             TCPDF_STATIC::sendOutputData($this->getBuffer(), $this->bufferlen);
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:67,代码来源:tcpdf.php


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