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


PHP dompdf_usage函数代码示例

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


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

示例1: php_sapi_name

                $opts["filename"] = $_SERVER["argv"][$i];
                $i++;
                break;
        }
    }
    return $opts;
}
require_once "dompdf_config.inc.php";
global $_dompdf_show_warnings;
global $_dompdf_debug;
$sapi = php_sapi_name();
switch ($sapi) {
    case "cli":
        $opts = getoptions();
        if (isset($opts["h"]) || !isset($opts["filename"]) && !isset($opts["l"])) {
            dompdf_usage();
            exit;
        }
        if (isset($opts["l"])) {
            echo "\nUnderstood paper sizes:\n";
            foreach (array_keys(CPDF_Adapter::$PAPER_SIZES) as $size) {
                echo "  " . mb_strtoupper($size) . "\n";
            }
            exit;
        }
        $file = $opts["filename"];
        if (isset($opts["p"])) {
            $paper = $opts["p"];
        } else {
            $paper = DOMPDF_DEFAULT_PAPER_SIZE;
        }
开发者ID:emeraldstudio,项目名称:somosmaestros,代码行数:31,代码来源:dompdf.php

示例2: pdf_create

function pdf_create($html, $filename, $stream)
{
    /* require_once("dompdf/dompdf_config.inc.php");
        spl_autoload_register('DOMPDF_autoload');
        //$dompdf = new DOMPDF();
        //$dompdf->set_paper("a4", "portrait"); 
        //$dompdf->load_html($html);
    
        $html = 'asdfhgfh Ξ';
        //$html = utf8_encode($html);
        $dompdf = new DOMPDF(); $html = iconv('UTF-8','Windows-1250',$html);
        $dompdf->load_html($html);
    
        $dompdf->render();
        $pdf = $dompdf->output();
        if ($stream) {
            $dompdf->stream($filename.".pdf");
        }else {
            ini_set('error_reporting', E_ALL);
            if(!write_file("./files/temp/".$filename.".pdf", $pdf)) {
                echo "files/temp/".$filename.".pdf". ' -> PDF could not be saved! Check your server settings!';
               die();
                }
        }
        */
    if (!function_exists('dompdf_usage')) {
        function dompdf_usage()
        {
            $default_paper_size = DOMPDF_DEFAULT_PAPER_SIZE;
            echo <<<EOD
  
Usage: {$_SERVER["argv"][0]} [options] html_file

html_file can be a filename, a url if fopen_wrappers are enabled, or the '-' character to read from standard input.

Options:
 -h             Show this message
 -l             List available paper sizes
 -p size        Paper size; something like 'letter', 'A4', 'legal', etc.  
                  The default is '{$default_paper_size}'
 -o orientation Either 'portrait' or 'landscape'.  Default is 'portrait'
 -b path        Set the 'document root' of the html_file.  
                  Relative urls (for stylesheets) are resolved using this directory.  
                  Default is the directory of html_file.
 -f file        The output filename.  Default is the input [html_file].pdf
 -v             Verbose: display html parsing warnings and file not found errors.
 -d             Very verbose: display oodles of debugging output: every frame 
                  in the tree printed to stdout.
 -t             Comma separated list of debugging types (page-break,reflow,split)
 
EOD;
            exit;
        }
    }
    /**
     * Parses command line options
     * 
     * @return array The command line options
     */
    if (!function_exists('getoptions')) {
        function getoptions()
        {
            $opts = array();
            if ($_SERVER["argc"] == 1) {
                return $opts;
            }
            $i = 1;
            while ($i < $_SERVER["argc"]) {
                switch ($_SERVER["argv"][$i]) {
                    case "--help":
                    case "-h":
                        $opts["h"] = true;
                        $i++;
                        break;
                    case "-l":
                        $opts["l"] = true;
                        $i++;
                        break;
                    case "-p":
                        if (!isset($_SERVER["argv"][$i + 1])) {
                            die("-p switch requires a size parameter\n");
                        }
                        $opts["p"] = $_SERVER["argv"][$i + 1];
                        $i += 2;
                        break;
                    case "-o":
                        if (!isset($_SERVER["argv"][$i + 1])) {
                            die("-o switch requires an orientation parameter\n");
                        }
                        $opts["o"] = $_SERVER["argv"][$i + 1];
                        $i += 2;
                        break;
                    case "-b":
                        if (!isset($_SERVER["argv"][$i + 1])) {
                            die("-b switch requires a path parameter\n");
                        }
                        $opts["b"] = $_SERVER["argv"][$i + 1];
                        $i += 2;
                        break;
                    case "-f":
//.........这里部分代码省略.........
开发者ID:imranweb7,项目名称:msitc-erp,代码行数:101,代码来源:dompdf_helper.php


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