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

PHP DOMPDF类代码示例

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

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



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

示例1: render

 public static function render($file, $html)
 {
     //generate some PDFs!
     $dompdf = new DOMPDF();
     //if you use namespaces you may use new \DOMPDF()
     $dompdf->load_html($html);
     $dompdf->setPaper('A5', 'landscape');
     $dompdf->render();
     $dompdf->stream($file . ".pdf", array("Attachment" => 0));
 }
开发者ID:patogalarzar,项目名称:composer,代码行数:10,代码来源:pdf.php


示例2: 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('[email protected]', '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


示例3: SSL_COMPRA_FACTURA

function SSL_COMPRA_FACTURA($transaccion, $salida = 'enlinea')
{
    $c = sprintf('SELECT procon.`codigo_producto`, procon.`titulo` AS "titulo_contenedor", provar.`descripcion` AS "titulo_variedad", provar.foto, comcon.`codigo_compra`, comcon.`codigo_usuario`, comcon.`codigo_variedad`, FORMAT(comcon.`precio_grabado`,2) AS precio_grabado, FORMAT(comcon.`precio_envio`,2) AS precio_envio, comcon.`direccion_entrega`, comcon.`fecha_entrega`, comcon.`tarjeta_de`, comcon.`tarjeta_para`, comcon.`tarjeta_cuerpo`, comcon.`usuario_notas`, comcon.`transaccion`, comcon.`fecha`, `estado`, `correo_contacto`, `telefono_remitente`, `usuario_notas`, `nombre_t_credito`,`estado_notas` FROM `flores_SSL_compra_contenedor` AS comcon LEFT JOIN `flores_producto_variedad` AS provar USING(codigo_variedad) LEFT JOIN `flores_producto_contenedor` AS procon USING(codigo_producto)  WHERE transaccion="%s"', db_codex($transaccion));
    $r = db_consultar($c);
    if (!mysql_num_rows($r)) {
        echo '<p>Lo sentimos, tal factura no existe</p>';
        return;
    }
    $f = mysql_fetch_assoc($r);
    $buffer = '<style>';
    $buffer .= 'table {border-collapse:collapse;}';
    $buffer .= 'table th{border-top:thin solid #c0c0c0;border-left:thin solid #c0c0c0;border-right:thin solid #c0c0c0;background-color:#eee;}';
    $buffer .= 'table td{border-top:thin solid #c0c0c0;border:1px solid #c0c0c0;}';
    $buffer .= '</style>';
    $buffer .= '<table style="width:100%">';
    $campo = array('Factura' => $f['transaccion'], 'F360' => $f['codigo_producto'] . ':' . $f['codigo_variedad'], 'Producto' => $f['titulo_contenedor'], 'Variedad' => $f['titulo_variedad'], 'Precio' => '$' . $f['precio_grabado'], 'Recargo de envio' => '$' . $f['precio_envio'], 'Total' => '$' . number_format($f['precio_grabado'] + $f['precio_envio'], 2, '.', ','), 'Remitente' => $f['tarjeta_de'], 'Destinatario' => $f['tarjeta_para'], 'Tarjeta' => $f['tarjeta_cuerpo'], 'Enviar a' => $f['direccion_entrega'], 'Fecha pedido' => date('d/m/Y'), 'Fecha de entrega' => date('d/m/Y', strtotime($f['fecha_entrega'])), 'Correo contacto' => $f['correo_contacto'], 'Teléfono remitente' => $f['telefono_remitente'], 'Notas adicionales del comprador' => $f['usuario_notas'] ? $f['usuario_notas'] : '[No especificó nada en especial]');
    foreach ($campo as $clave => $valor) {
        $buffer .= sprintf('<tr><td>%s</td><td style="font-weight:bold">%s</td></tr>', $clave, $valor);
    }
    $buffer .= '</table>';
    switch ($salida) {
        case 'enlinea':
            return array($buffer, $f);
            break;
        case 'pdf':
            $buffer = '<html><body>' . $buffer . '</body></html>';
            require_once 'PHP/dompdf/dompdf_config.inc.php';
            $dompdf = new DOMPDF();
            $dompdf->load_html($buffer);
            //$dompdf->render();
            //$dompdf->stream("factura-$transaccion.pdf");
    }
}
开发者ID:vlad88sv,项目名称:360,代码行数:33,代码来源:ssl.comun.php


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


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


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


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


示例8: print_ledger

 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


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


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


示例11: __construct

 function __construct(Frame $frame, DOMPDF $dompdf)
 {
     parent::__construct($frame);
     $url = $frame->get_node()->getAttribute("src");
     if (!DOMPDF_ENABLE_REMOTE && strstr($url, "://")) {
         $this->_remote = false;
         $this->_image_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
     } else {
         if (DOMPDF_ENABLE_REMOTE && strstr($url, "://")) {
             // Download remote files to a temporary directory
             $this->_remote = true;
             $this->_image_url = tempnam(DOMPDF_TEMP_DIR, "dompdf_img_");
             file_put_contents($this->_image_url, file_get_contents($url));
         } else {
             $this->_remote = false;
             $this->_image_url = build_url($dompdf->get_protocol(), $dompdf->get_host(), $dompdf->get_base_path(), $url);
         }
     }
     if (!is_readable($this->_image_url) || !filesize($this->_image_url)) {
         $this->_remote = false;
         $this->_image_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
     }
     // We need to preserve the file extenstion
     $i = strrpos($url, ".");
     if ($i === false) {
         throw new DOMPDF_Exception("Unknown image type: {$url}.");
     }
     $this->_image_ext = strtolower(substr($url, $i + 1));
 }
开发者ID:andrewroth,项目名称:c4c_intranet,代码行数:29,代码来源:image_frame_decorator.cls.php


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


示例13: html2pdf

 function html2pdf($html, $nombre = 'formato.pdf')
 {
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->set_paper($this->paper, $this->orien);
     $dompdf->render();
     $dompdf->stream($nombre, array('Attachment' => false));
 }
开发者ID:enderochoa,项目名称:tortuga,代码行数:8,代码来源:cidompdf.php


示例14: output

 /**
  * Generates Pdf from html
  *
  * @return string raw pdf data
  */
 public function output()
 {
     $DomPDF = new DOMPDF();
     $DomPDF->set_paper($this->_Pdf->pageSize(), $this->_Pdf->orientation());
     $DomPDF->load_html($this->_Pdf->html());
     $DomPDF->render();
     return $DomPDF->output();
 }
开发者ID:kuwox,项目名称:buenavista,代码行数:13,代码来源:DomPdfEngine.php


示例15: pdf

function pdf($data, $type, $number)
{
    $title = $type . ' ' . $number;
    $pdf = new DOMPDF();
    $pdf->load_html($data);
    $pdf->render();
    $pdf->stream($title . '.pdf');
}
开发者ID:skyosev,项目名称:OpenCart-Overclocked,代码行数:8,代码来源:pdf.php


示例16: pdf_create

function pdf_create($html, $filename = '')
{
    require_once "dompdf/dompdf_config.inc.php";
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    $dompdf->stream($filename, array("Attachment" => false));
}
开发者ID:rodino25,项目名称:tsv2,代码行数:8,代码来源:dompdf_helper.php


示例17: render

 public static function render($file, $html)
 {
     static::configure();
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->render();
     $dompdf->stream("{$file}.pdf");
 }
开发者ID:jonnyalexbh,项目名称:stydeComposer,代码行数:8,代码来源:pdf.php


示例18: pdf_create

function pdf_create($html, $filename)
{
    require_once "dompdf/dompdf_config.inc.php";
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    $dompdf->stream($filename . ".pdf");
}
开发者ID:wrtcoder,项目名称:EasyHotspot,代码行数:8,代码来源:to_pdf_pi.php


示例19: pdf_create

function pdf_create($html, $filename, $paper, $orientation, $stream = TRUE)
{
    $dompdf = new DOMPDF();
    $dompdf->set_paper($paper, $orientation);
    $dompdf->load_html($html);
    $dompdf->render();
    $dompdf->stream($filename);
}
开发者ID:redines,项目名称:MySite,代码行数:8,代码来源:pdf_convert.php


示例20: transform

 /**
  * This method combines the ProjectDescriptor and the given target template
  * and creates a static html page at the artifact location.
  *
  * @param ProjectDescriptor $project        Document containing the structure.
  * @param Transformation    $transformation Transformation to execute.
  *
  * @return void
  */
 public function transform(ProjectDescriptor $project, Transformation $transformation)
 {
     parent::transform($project, $transformation);
     $dompdf = new \DOMPDF();
     $dompdf->load_html(file_get_contents($this->destinationPath));
     $dompdf->render();
     file_put_contents($transformation->getTransformer()->getTarget() . DIRECTORY_SEPARATOR . $transformation->getArtifact(), $dompdf->output());
 }
开发者ID:noname007,项目名称:phpDocumentor2,代码行数:17,代码来源:Pdf.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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