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


PHP DOMPDF::render方法代码示例

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


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

示例1: pdf_create

function pdf_create($html, $filename = '', $stream = TRUE, $invoice_id, $type)
{
    require_once "dompdf/dompdf_config.inc.php";
    if (get_magic_quotes_gpc()) {
        $html = stripslashes($html);
    }
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->set_paper("a4", "portrait");
    $dompdf->render();
    $timestamp = date('YmdGis') . $invoice_id;
    $filename = $timestamp . '.pdf';
    if ($stream) {
        $dompdf->stream($filename);
    } else {
        if ($type == 'invoice') {
            $CI =& get_instance();
            $CI->load->helper('file');
            write_file("invoice/" . $filename, $dompdf->output());
            return $filename;
        } else {
            if ($type == 'salary') {
                $CI =& get_instance();
                $CI->load->helper('file');
                write_file("salary_slip/" . $filename, $dompdf->output());
                return $filename;
            }
        }
    }
}
开发者ID:haseeb736,项目名称:test,代码行数:30,代码来源:dompdf_helper.php

示例2: 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

示例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

 /**
  * Render a pdf document
  * @param string $html The html to be rendered
  *
  * @throws \LogicException
  */
 protected function render($html)
 {
     // DOMPDF doesn't follow PSR convention, it uses classmap in autoload
     // and it requires some config to be used
     define('DOMPDF_ENABLE_AUTOLOAD', false);
     $filePath = $this->rootDir . "/../vendor/dompdf/dompdf/dompdf_config.inc.php";
     if (file_exists($filePath)) {
         require_once $filePath;
     } else {
         throw new \RuntimeException('DomPDF cannot be loaded');
     }
     $this->dompdf = new \DOMPDF();
     $this->dompdf->set_paper(DOMPDF_DEFAULT_PAPER_SIZE);
     $this->dompdf->load_html($html);
     $this->dompdf->render();
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:22,代码来源:DompdfBuilder.php

示例5: rebuild_pdf_application

 public function rebuild_pdf_application($uid)
 {
     $this->load->library('dompdf');
     $this->mongo_db->switch_db('gwc');
     $this->mongo_db->where('uid', $uid);
     $app_data = $this->mongo_db->get('applications');
     $dompdf = new DOMPDF();
     $dompdf->load_html($this->load->view('alt_export_pdf', array('post' => $app_data[0]), TRUE));
     $dompdf->render();
     $pdf_filename = time() . '_' . $uid . '.pdf';
     $fp = @fopen("../pdf/{$pdf_filename}", 'w');
     if ($fp != false) {
         fwrite($fp, $dompdf->output(0));
         fclose($fp);
         $this->mongo_db->switch_db('gwc');
         $this->mongo_db->where('uid', $uid);
         $this->mongo_db->set('pdf_filename', $pdf_filename);
         $this->mongo_db->update('applications');
         return 'success';
     } else {
         $this->load->library('email');
         $this->email->from('no_reply@learninghouse.com', 'student portal');
         $this->email->to($this->config->item('rebuild_pdf_email'));
         $this->email->subject('Student Portal Error');
         $this->email->message('Student portal tried to REBUILD a pdf but the PDF dir is not writtable. Please check PDF permissions. -' . $_SERVER['HTTP_HOST']);
         $this->email->send();
         $pdf_filename = 'failed';
     }
     $this->mongo_db->switch_db('gwc');
     $this->mongo_db->where('uid', $uid);
     $this->mongo_db->set('pdf_filename', $pdf_filename);
     $this->mongo_db->update('applications');
     return 'failed';
 }
开发者ID:robeysan,项目名称:studentportal,代码行数:34,代码来源:application_model.php

示例6: render

 function render()
 {
     $document = Document::find($_SESSION['document_id']);
     $html = file_get_contents('app/views/render/header.pdf.php');
     $html .= '<div id="cover">
   <img src="public/uploads/' . $document->logo . '">
   <h1>' . "Plano Diretor de Tecnologia da Informação da Prefeitura Municipal de Guaraci" . '</h1>
   <h3>LONDRINA - PR</h3>
   <h3>' . $document->year . '</h3>
 </div>';
     $html .= file_get_contents('app/views/render/logos.pdf.php');
     foreach ($this->sections as $section => $subs) {
         $model = Document::find($_SESSION['document_id'])->{$section}();
         $counter = 1;
         foreach ($subs as $label => $name) {
             $html .= '<h2>' . $counter . " {$name}</h2><p>" . $model->{$label} . "</p>";
             $counter += 0.1;
         }
     }
     $html .= '</div></body></html>';
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->render();
     header('Content-Type: application/pdf');
     echo $dompdf->output();
 }
开发者ID:hugoabonizio,项目名称:BirdsPHP-scaffold,代码行数:26,代码来源:render_controller.php

示例7: creapdf

 public static function creapdf($url, $tam = "letter", $orient = "portrait")
 {
     //		file_put_contents("fila.txt", "");
     $html = file_get_contents($url);
     if (get_magic_quotes_gpc()) {
         $html = stripslashes($html);
     }
     $ini = strpos($html, '<form');
     $fin = strpos($html, '">', $ini);
     if ($ini > 0) {
         $html = substr_replace($html, "", $ini, $fin - $ini + 2);
         $html = str_replace("</form>", "", $html);
     }
     //		file_put_contents("fila.txt", $html . "\r\n", FILE_APPEND);
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->set_paper($tam, $orient);
     $dompdf->render();
     $dompdf->view = "FitH";
     $dompdf->statusbar = 0;
     $dompdf->messages = 0;
     $dompdf->navpanes = 0;
     $dompdf->stream("sample.pdf", array("Attachment" => false));
     exit(0);
 }
开发者ID:algerion,项目名称:compartidos,代码行数:25,代码来源:usadompdf.php

示例8: render

 function render()
 {
     $document = Document::find($_SESSION['document_id']);
     $this->html = file_get_contents('app/views/render/header.pdf.php');
     $this->html .= '<div id="cover">
   <img src="public/uploads/' . $document->logo . '">
   <h1>' . $document->name . '</h1>
   <div style="position: fixed; bottom: 50px;">
     <h3>LONDRINA - PR</h3>
     <h3>' . $document->year . '</h3>
   </div>
 </div>';
     $this->html .= file_get_contents('app/views/render/logos.pdf.php');
     $counter = 0;
     foreach ($this->sections as $section => $subs) {
         $model = Document::find($_SESSION['document_id'])->{$section};
         $counter = floor($counter) + 1;
         foreach ($subs as $label => $name) {
             if ($label == 'swot') {
                 $this->render_swot($model);
             } else {
                 $this->html .= '<h2>' . $counter . " {$name}</h2><p>" . $model->{$label} . "</p>";
                 $counter += 0.1;
             }
         }
     }
     $this->html .= '</div></body></html>';
     $dompdf = new DOMPDF();
     $dompdf->load_html($this->html);
     $dompdf->render();
     header('Content-Type: application/pdf');
     echo $dompdf->output();
 }
开发者ID:hugoabonizio,项目名称:GaiaPDTI,代码行数:33,代码来源:render_controller.php

示例9: redirect

 function print_ledger()
 {
     $daterange1 = $this->input->post('daterange1');
     $daterange2 = $this->input->post('daterange2');
     $account_id = $this->input->post('account_id');
     if (empty($daterange1)) {
         redirect('pdf/ledger_date');
     } else {
         $daterange1 = date("Y-m-d", strtotime($daterange1));
         $daterange2 = date("Y-m-d", strtotime($daterange2));
         $data['user_name'] = $this->authex->get_user_name();
         $user_info = $this->authex->get_userdata();
         $data['level'] = $user_info->level;
         $this->load->model('mod_report');
         $data['records'] = $this->mod_report->ledger($daterange1, $daterange2, $account_id);
         $this->load->model('mod_report');
         $info = $this->mod_report->ledger_begining_bal($daterange1, $daterange2, $account_id);
         $data['op_balance'] = $info['op_balance'];
         $data['account_name'] = $info['account_name'];
         $data['daterange1'] = date("d-m-Y", strtotime($daterange1));
         $data['daterange2'] = date("d-m-Y", strtotime($daterange2));
         include_once 'dompdf/dompdf_config.inc.php';
         $html = $this->load->view('print/print_ledger', $data, true);
         $dompdf = new DOMPDF();
         $base_path = $_SERVER['DOCUMENT_ROOT'];
         $dompdf->load_html($html);
         $file_name = "Ledger_" . $info['account_name'];
         $dompdf->render();
         $dompdf->stream("{$file_name}.pdf", array("Attachment" => 0));
     }
 }
开发者ID:ocpyosep78,项目名称:erp,代码行数:31,代码来源:pdf.php

示例10: create_pdf

function create_pdf($data, $filename = '', $stream = TRUE, $papersize = 'letter', $orientation = 'portrait')
{
    require_once "dompdf/dompdf_config.inc.php";
    $dompdf = new DOMPDF();
    $dompdf->load_html(' ');
    $dompdf->render();
    $canvas = $dompdf->get_canvas();
    $font = Font_Metrics::get_font("helvetica");
    $fontBold = Font_Metrics::get_font("helvetica", "bold");
    $row = 1;
    $y = 25;
    for ($i = 0; $i < count($data); $i++) {
        if (strpos($data[$i], "STUDENT") !== FALSE) {
            $canvas->text(40, $y += 15, $data[$i], $fontBold, 10, array(0, 0, 0));
        } elseif (strpos($data[$i], "COLLEGE") !== FALSE || strpos($data[$i], "UNIVERSITY") !== FALSE) {
            $canvas->text(40, $y += 15, $data[$i], $fontBold, 10, array(0, 0, 0));
        } elseif (strpos($data[$i], "__") !== FALSE || $data[$i] == " ") {
            $canvas->text(40, $y += 9, $data[$i], $font, 10, array(0, 0, 0));
        } else {
            $canvas->text(40, $y += 15, $data[$i], $font, 10, array(0, 0, 0));
        }
        if ($y > 730) {
            $dompdf->get_canvas()->new_page();
            $y = 50;
        }
    }
    if ($stream) {
        $dompdf->stream($filename . ".pdf");
    } else {
        return $dompdf->output();
    }
}
开发者ID:google-code-backups,项目名称:upm-oset,代码行数:32,代码来源:dompdf_helper.php

示例11: DOMPDF

 function pdf_create($html, $filename, $stream = FALSE)
 {
     require_once "dompdf/dompdf_config.inc.php";
     spl_autoload_register('DOMPDF_autoload');
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->set_paper("A4");
     $dompdf->render();
     if ($stream) {
         $dompdf->stream($filename . ".pdf");
     } else {
         $CI =& get_instance();
         $CI->load->helper('file');
         write_file("./pdf-report/" . $filename . ".pdf", $dompdf->output());
         $file = "./pdf-report/" . $filename . ".pdf";
         header('Content-Description: File Transfer');
         header('Content-Type: application/octet-stream');
         header("Content-Type: application/force-download");
         header('Content-Disposition: attachment; filename=' . urlencode(basename($file)));
         header('Expires: 0');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Pragma: public');
         header('Content-Length: ' . filesize($file));
         ob_clean();
         flush();
         readfile($file);
         exit;
         unlink($file);
     }
 }
开发者ID:mylinkedshare,项目名称:app-percetakan,代码行数:30,代码来源:gen_pdf_helper.php

示例12: PDFStop

function PDFStop($handle)
{
    global $OutputType, $htmldocAssetsPath;
    if ($OutputType == "PDF") {
        $html = ob_get_contents();
        ob_end_clean();
        $html = '<HTML><BODY>' . $html . '</BODY></HTML>';
        require_once "dompdf/dompdf_config.inc.php";
        //require_once("convertcharset/ConvertCharset.class.php");
        //$html = $convertcharset->Convert($html, 'utf-8', 'iso-8859-1');
        /*
        
        $fp = @fopen($temphtml,"w");
        if (!$fp)
        	die("Can't open $temphtml");
        fputs($fp, $html);
        @fclose($fp);
        */
        $dompdf = new DOMPDF();
        $dompdf->load_html($html);
        $dompdf->render();
        $dompdf->stream(ProgramTitle() . ".pdf", array("Attachment" => 0));
        //header("Location:dompdf/dompdf.php?input_file=tmp/sis.htm&output_file=sample.pdf");
    } else {
        $html = ob_get_contents();
        ob_end_clean();
        $html = '<HTML><BODY>' . $html . '</BODY></HTML>';
        echo $html;
    }
}
开发者ID:SysBind,项目名称:opensis-ml,代码行数:30,代码来源:PDFStop.fnc.php

示例13: from_html

 public static function from_html($html, $title)
 {
     // give us soem breathing room
     ini_set('max_execution_time', 180);
     //$ohtml = $html;
     // pre-parse remote or url based assets
     try {
         $html = self::_pre_parse_remote_assets($html);
     } catch (Exception $e) {
         die('error');
         echo '<h1>Problem parsing html.</h1>';
         echo '<h2>' . force_balance_tags($e->getMessage()) . '</h2>';
         return;
     }
     // if we are debugging the pdf, then depending on the mode, dump the html contents onw
     if (QSOT_DEBUG_PDF & 2) {
         // || ( current_user_can( 'edit_posts' ) && isset( $_GET['as'] ) && 'html' == $_GET['as'] ) ) {
         echo '<pre>';
         echo htmlspecialchars($html);
         echo '</pre>';
         die;
     }
     // include the library
     require_once QSOT::plugin_dir() . 'libs/dompdf/dompdf_config.inc.php';
     // make and output the pdf
     $pdf = new DOMPDF();
     $pdf->load_html($html);
     $pdf->render();
     $pdf->stream(sanitize_title_with_dashes('ticket-' . $title) . '.pdf', array('Attachment' => 1));
     exit;
 }
开发者ID:Jayriq,项目名称:opentickets-community,代码行数:31,代码来源:pdf.class.php

示例14: get_dom_pdf

 public function get_dom_pdf()
 {
     $this->load->helper('dompdf_helper');
     $this->load->library('users/auth');
     if (isset($_POST) && $this->auth->is_logged_in()) {
         $html_content = '<style type="text/css">td{ color : #FF0000;}</style>';
         $html_content .= $_POST['content'];
         $file_name = $_POST['filename'];
         $stream = false;
         dompdf();
         $dompdf = new DOMPDF();
         $dompdf->load_html($html_content);
         $dompdf->render();
         if ($stream) {
             $dompdf->stream($file_name . ".pdf");
         } else {
             //return $dompdf->output();
             $output = $dompdf->output();
             $file_to_save = 'temp/' . $file_name . '.pdf';
             file_put_contents($file_to_save, $output);
         }
         $this->output->set_content_type('application/json')->set_output(json_encode($html_content));
         return true;
     }
     return false;
     Template::render('drhil02/ajax');
 }
开发者ID:fbmfbm,项目名称:drhil01,代码行数:27,代码来源:ajax.php

示例15: convert

 /**
  * Convert data
  *
  * @param   string  $data
  * @return  string
  */
 public function convert($data)
 {
     $dompdf = new DOMPDF();
     $dompdf->load_html($data);
     $dompdf->render();
     return $dompdf->output();
 }
开发者ID:justinhernandez,项目名称:convert,代码行数:13,代码来源:Dompdf.php


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