當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。