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


PHP DOMPDF::set_protocol方法代码示例

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


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

示例1: render

 public function render($view = null, $layout = null)
 {
     try {
         ob_start();
         if (defined('DOMPDF_TEMP_DIR')) {
             $dir = new SplFileInfo(DOMPDF_TEMP_DIR);
             if (!$dir->isDir() || !$dir->isWritable()) {
                 trigger_error(__('%s is not writable', DOMPDF_TEMP_DIR), E_USER_WARNING);
             }
         }
         $errors = ob_get_contents();
         ob_end_clean();
         $download = false;
         $name = pathinfo($this->here, PATHINFO_BASENAME);
         $paperOrientation = 'portrait';
         $paperSize = 'letter';
         extract($this->viewVars, EXTR_IF_EXISTS);
         $dompdf = new DOMPDF();
         $dompdf->load_html($errors . parent::render($view, $layout), Configure::read('App.encoding'));
         $dompdf->set_protocol('');
         $dompdf->set_protocol(WWW_ROOT);
         $dompdf->set_base_path('/');
         $dompdf->set_paper($paperSize, $paperOrientation);
         $dompdf->render();
         $dompdf->stream($name, array('Attachment' => $download));
     } catch (Exception $e) {
         $this->request->params['ext'] = 'html';
         throw $e;
     }
 }
开发者ID:raunakbinani,项目名称:cakephp-dompdf-view,代码行数:30,代码来源:PdfView.php

示例2: prepare

 /**
  * Préparation de dompdf pour la conversion
  * 
  * @param string $format      format de la page
  * @param string $orientation orientation de la page
  * 
  * @return void
  */
 function prepare($format, $orientation)
 {
     CAppUI::requireModuleFile("dPcompteRendu", "dompdf_config");
     CAppUI::requireLibraryFile("dompdf/dompdf_config.inc");
     $this->dompdf = new dompdf();
     $this->dompdf->set_base_path(realpath(dirname(__FILE__) . "/../../../../"));
     $this->dompdf->set_paper($format, $orientation);
     if (CAppUI::conf("dPcompteRendu CCompteRendu dompdf_host")) {
         $this->dompdf->set_protocol(isset($_SERVER["HTTPS"]) ? "https://" : "http://");
         $this->dompdf->set_host($_SERVER["SERVER_NAME"]);
     }
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:20,代码来源:CDomPDFConverter.class.php

示例3: gerarpdf

    public function gerarpdf($idCi)
    {
        require_once "../helpers/dompdf/dompdf_config.inc.php";
        $ci = Viewci::get($idCi);
        if ($ci) {
            $html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="Stylesheet" type="text/css" href="' . ROOT_VIRTUAL . '/css/style-cipdf.css" /> </head>';
            for ($i = 1; $i <= 2; $i++) {
                $observacoes = Viewobservacao::allByCi($ci->Id);
                $html .= '<body><center> <b>' . $i . 'º Via </b> Data:' . date('d/m/Y H:i:s', time()) . '</center><table style="margin:auto;" class="bordasimples">' . '<tbody>' . '<tr>' . '<th rowspan=4><img src="' . ROOT_VIRTUAL . 'img/logo-ulbra.png" width="50%"/></th>' . '<td><b>Data: </b>' . date('d/m/Y', $ci->Data) . '</td>' . '</tr>
						<tr><td><b>Assunto: </b>' . $ci->Assunto . '</td></tr>' . '<tr><td><b>De: </b>' . $ci->NomeDe . ' </td></tr>' . '<tr><td><b>Para: </b>' . $ci->NomePara . '</td></tr>' . '<tr><td colspan="2">' . $ci->Conteudo . '<br><br>Atenciosamente, <br><br><center>' . $ci->NomeUsuarioAtenciosamente . '</center><center>' . $ci->CargoUsuarioAtenciosamente . '</center><br></td></tr>' . '</tbody>' . '</table >';
                if ($observacoes) {
                    $html .= '<center><h3>Observações</h3></center><table style="margin:auto;" class="bordasimples" width="80%"> <tbody>';
                    foreach ($observacoes as $ob) {
                        $html .= '
						<tr>
						  <td>' . $ob->Nome . '  -  ' . date('d/m/Y H:i', $ob->Data) . '</td>
						  </tr><tr><td>' . $ob->Conteudo . '</td>
						</tr>';
                    }
                    $html .= '</table>';
                }
                $html .= '<br><br><hr><br>';
            }
            $html .= '</body></html>';
            $dompdf = new DOMPDF();
            $dompdf->load_html($html);
            $dompdf->set_host('localhost');
            $dompdf->set_protocol('http://');
            $dompdf->render();
            $dompdf->stream("sample.pdf");
        } else {
            $this->_flash('alert alert-error fade in', 'CI não encontrada');
        }
        exit;
    }
开发者ID:nylmarcos,项目名称:estagio,代码行数:35,代码来源:CiController.php

示例4: render

 public function render($view = null, $layout = null)
 {
     try {
         ob_start();
         if (defined('DOMPDF_TEMP_DIR')) {
             $dir = new SplFileInfo(DOMPDF_TEMP_DIR);
             if (!$dir->isDir() || !$dir->isWritable()) {
                 trigger_error(__('%s is not writable', DOMPDF_TEMP_DIR), E_USER_WARNING);
             }
         }
         $errors = ob_get_contents();
         ob_end_clean();
         $download = false;
         $name = pathinfo($this->here, PATHINFO_BASENAME);
         $paperOrientation = 'portrait';
         $paperSize = 'letter';
         $preData = null;
         $postData = null;
         extract($this->viewVars, EXTR_IF_EXISTS);
         $dompdf = new DOMPDF();
         $dompdf->set_protocol('');
         $dompdf->set_protocol(WWW_ROOT);
         $dompdf->set_base_path('/');
         $dompdf->set_paper($paperSize, $paperOrientation);
         if (!empty($preData) || !empty($postData)) {
             App::import('Vendor', 'Dompdf.PDFMerger', true, array(), 'PDFMerger' . DS . 'PDFMerger.php');
             $merger = new PDFMerger();
             if (!empty($preData)) {
                 $merger->addPdfData($preData, DOMPDF_TEMP_DIR);
             }
             //Get the static information sheet
             $merger->addPdfData(file_get_contents("../View/Courses/survey_explanation.pdf"), DOMPDF_TEMP_DIR);
             if (!empty($postData)) {
                 $merger->addPdfData($postData, DOMPDF_TEMP_DIR);
             }
             $merger->merge($download ? 'download' : 'browser');
         } else {
             $dompdf->stream($name, array('Attachment' => $download));
         }
     } catch (Exception $e) {
         $this->request->params['ext'] = 'html';
         throw $e;
     }
 }
开发者ID:byu-oit-appdev,项目名称:student-ratings,代码行数:44,代码来源:PdfView.php


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