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


PHP DOMPDF::load_html_file方法代码示例

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


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

示例1: loadFile

 /**
  * Load a HTML file
  *
  * @param string $file
  * @return static
  */
 public function loadFile($file)
 {
     $this->init();
     $this->dompdf->load_html_file($file);
     $this->rendered = false;
     return $this;
 }
开发者ID:ahmedash95,项目名称:laravel-dompdf,代码行数:13,代码来源:PDF.php

示例2: pdf_create

/**
 * Create a PDF
 *
 * The minimum required to create a PDF is some HTML provided as a string.
 * This is easily done in CI by providing the contents of a view.
 *
 * Example:
 * ------------------------------------------------------
 *   $this->load->helper('pdf_creation');
 *   $html = $this->load->view(
 *             'pdf_template', 
 *             ( isset( $view_data ) ) ? $view_data : '', 
 *             TRUE 
 *   );
 *   pdf_create( $html );
 * ------------------------------------------------------
 *
 * @param  string  HTML to be used for making a PDF
 * @param  array   Configuration options
 */
function pdf_create($html, $config = array())
{
    $defaults = array('output_type' => 'stream', 'filename' => microtime(TRUE) . '.pdf', 'upload_dir' => FCPATH . 'upload_directory/pdfs/', 'load_html' => TRUE, 'html_encoding' => '', 'load_html_file' => FALSE, 'output_compression' => 1, 'set_base_path' => FALSE, 'set_paper' => FALSE, 'paper_size' => 'letter', 'paper_orientation' => 'portrait', 'stream_compression' => 1, 'stream_attachment' => 1);
    // Set options from defaults and incoming config array
    $options = array_merge($defaults, $config);
    // Remove any previously created headers
    if (is_php('5.3.0') && $options['output_type'] == 'stream') {
        header_remove();
    }
    // Load dompdf
    require_once "dompdf/dompdf_config.inc.php";
    // Create a dompdf object
    $dompdf = new DOMPDF();
    // Set supplied base path
    if ($options['set_base_path'] !== FALSE) {
        $dompdf->set_base_path($options['set_base_path']);
    }
    // Set supplied paper
    if ($options['set_paper'] !== FALSE) {
        $dompdf->set_paper($options['paper_size'], $options['paper_orientation']);
    }
    // Load the HTML that will be turned into a PDF
    if ($options['load_html_file'] !== FALSE) {
        // Loads an HTML file
        $dompdf->load_html_file($html);
    } else {
        // Loads an HTML string
        $dompdf->load_html($html, $options['html_encoding']);
    }
    // Create the PDF
    $dompdf->render();
    // If destination is the browser
    if ($options['output_type'] == 'stream') {
        $dompdf->stream($options['filename'], array('compress' => $options['stream_compression'], 'Attachment' => $options['stream_attachment']));
    } else {
        if ($options['output_type'] == 'string') {
            return $dompdf->output($options['output_compression']);
        } else {
            // Get an instance of CI
            $CI =& get_instance();
            // Create upload directories if they don't exist
            if (!is_dir($options['upload_path'])) {
                mkdir($options['upload_path'], 0777, TRUE);
            }
            // Load the CI file helper
            $CI->load->helper('file');
            // Save the file
            write_file($options['upload_path'] . $options['filename'], $dompdf->output());
        }
    }
}
开发者ID:Osub,项目名称:Community-Auth-For-CodeIgniter-3,代码行数:71,代码来源:pdf_creation_helper.php

示例3: DOMPDF

        }
        $outfile = "dompdf_out.pdf";
        # Don't allow them to set the output file
        $save_file = false;
        # Don't save the file
        break;
}
$dompdf = new DOMPDF();
if ($file == "-") {
    $str = "";
    while (!feof(STDIN)) {
        $str .= fread(STDIN, 4096);
    }
    $dompdf->load_html($str);
} else {
    $dompdf->load_html_file($file);
}
if (isset($base_path)) {
    $dompdf->set_base_path($base_path);
}
$dompdf->set_paper($paper, $orientation);
$dompdf->render();
if ($_dompdf_show_warnings) {
    foreach ($_dompdf_warnings as $msg) {
        echo $msg . "\n";
    }
    flush();
}
if ($save_file) {
    //   if ( !is_writable($outfile) )
    //     throw new DOMPDF_Exception("'$outfile' is not writable.");
开发者ID:emeraldstudio,项目名称:somosmaestros,代码行数:31,代码来源:dompdf.php

示例4: renderFile

 /**
  *
  * @param string $file 
  */
 public function renderFile($file)
 {
     $this->_domPdf->load_html_file($file);
 }
开发者ID:fredcido,项目名称:simuweb,代码行数:8,代码来源:DomPdf.php


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