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


PHP DOMPDF::set_paper方法代码示例

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


在下文中一共展示了DOMPDF::set_paper方法的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: 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: 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

示例4: pdf_create

function pdf_create($html, $filename = '', $stream = TRUE)
{
    require_once "dompdf-master/dompdf_config.inc.php";
    $dompdf = new DOMPDF();
    $dompdf->set_paper('a4', 'landscape');
    $dompdf->load_html($html);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename . ".pdf", array("Attachment" => false));
    } else {
        return $dompdf->output();
    }
}
开发者ID:hasan37,项目名称:sj,代码行数:13,代码来源:dompdf_helper.php

示例5: pdf_create

function pdf_create($html, $filename = '', $stream = TRUE, $paper = 'Letter', $orientation = 'portrait')
{
    require_once "dompdf/dompdf_config.inc.php";
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->set_paper($paper, $orientation);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename . '.pdf', array("Attachment" => 0));
    } else {
        return $dompdf->output();
    }
}
开发者ID:achyar10,项目名称:hras,代码行数:13,代码来源:dompdf_helper.php

示例6: cargarDocumento

 public static function cargarDocumento($html, $nombre, $salida, $correo, $curso, $edicion, $orientacion = 'horizontal')
 {
     //$html = file_get_contents('http://localhost/mercal/index.php?ctrl=almacen&acc=mostAlma');
     //$html = file_get_contents('http://localhost/mercal/index.php?ctrl=entrada&acc=listado');
     # Instanciamos un objeto de la clase DOMPDF.
     $mipdf = new DOMPDF();
     # Definimos el tamaño y orientación del papel que queremos.
     # O por defecto tomará el que está en el fichero de configuración. // portrait
     if ($orientacion == 'horizontal') {
         $mipdf->set_paper("A4", "landscape");
     } elseif ($orientacion == 'vertical') {
         $mipdf->set_paper("A4", "portrait");
     }
     $html = preg_replace('/á/', 'á', $html);
     $html = preg_replace('/(Á)/', 'Á', $html);
     $html = preg_replace('/é/', 'é', $html);
     $html = preg_replace('/(É)/', 'É', $html);
     $html = preg_replace('/í/', 'í', $html);
     $html = preg_replace('/(Í)/', 'Í', $html);
     $html = preg_replace('/ó/', 'ó', $html);
     $html = preg_replace('/(Ó)/', 'Ó', $html);
     $html = preg_replace('/ú/', 'ú', $html);
     $html = preg_replace('/(Ú)/', 'Ú', $html);
     $html = preg_replace('/(ñ)/', 'ñ', $html);
     $html = preg_replace('/(Ñ)/', 'Ñ', $html);
     # Cargamos el contenido HTML.
     $mipdf->load_html(utf8_decode($html));
     # Renderizamos el documento PDF.
     $mipdf->render();
     # Enviamos el fichero PDF al navegador.
     //$mipdf ->stream($nombre . '.pdf');
     if ($salida == 'guardar') {
         $output = $mipdf->output();
         //	file_put_contents('recursos/'.$nombre . '.pdf', $output);
         $archivo = 'recursos/' . $nombre . '.pdf';
         //		$archivo = ''.$nombre.'.pdf';
         //	$contacto = new contacto("Certificado de Participación", "Certificado de Participación:", $correo, $archivo, $curso, $edicion);
         //	$resultado = $contacto->enviarCertificado();
     } elseif ($salida == 'descargar') {
         $archivo = $mipdf->stream($nombre . '.pdf');
         $contacto = new contacto("Certificado de Participación", "Certificado de Participación:", $correo);
         $resultado = $contacto->enviarCorreo();
         $mipdf->stream('recursos/' . $nombre . '.pdf');
     } elseif ($salida == 'enviar') {
         $output = $mipdf->output();
         file_put_contents('recursos/Certificado.pdf', $output);
         $archivo = 'recursos/' . $nombre . '.pdf';
         $archivo = '' . $nombre . '.pdf';
         $contacto = new contacto("Certificado de Participación", "Certificado de Participación:", $correo, $archivo, $curso, $edicion);
         $resultado = $contacto->enviarCertificado();
     }
 }
开发者ID:CodeFuentes,项目名称:SARAVIS,代码行数:52,代码来源:generarPDF.php

示例7: DOMPDF

 function html2pdf($html, $nombre = 'formato.pdf', $attach = false)
 {
     $dompdf = new DOMPDF();
     if (preg_match('/<!\\-\\-\\@size_paper (?P<x>[0-9\\.]+)x(?P<y>[0-9\\.]+)\\-\\->/', $html, $matches)) {
         $x = $matches['x'] * 72 / 25.4;
         $y = $matches['y'] * 72 / 25.4;
         $dompdf->set_paper(array(0, 0, $x, $y), $this->orien);
     } else {
         $dompdf->set_paper($this->paper, $this->orien);
     }
     $dompdf->load_html($html);
     $dompdf->render();
     $dompdf->stream($nombre, array('Attachment' => $attach));
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:14,代码来源:cidompdf.php

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

示例9: initContent

 public function initContent()
 {
     parent::initContent();
     $id = $_GET['id'];
     $id_lang = $this->context->language->id;
     $product = new Product((int) $id);
     $link = new Link();
     $url = $link->getProductLink($product);
     $features = Db::getInstance()->ExecuteS('
 		SELECT fl.name feature_name, fvl.value feature_value
 		FROM ' . _DB_PREFIX_ . 'feature_product fp
 		LEFT JOIN ' . _DB_PREFIX_ . 'feature_lang fl ON (fl.id_feature = fp.id_feature AND fl.id_lang=' . $id_lang . ' )
 		LEFT JOIN ' . _DB_PREFIX_ . 'feature_value_lang fvl ON (fvl.id_feature_value = fp.id_feature_value AND fvl.id_lang=' . $id_lang . ')
 		WHERE fp.id_product=' . $id);
     //	print_r($features);
     $images = Image::getImages((int) $id_lang, (int) $product->id);
     //Limitamos el numero de fotos a cuatro solamente
     while (count($images) > 3) {
         $var = array_pop($images);
     }
     $this->context->smarty->assign(array('product' => $product, 'lang' => $id_lang, 'image' => $images, 'dir' => Tools::getHttpHost(true) . __PS_BASE_URI__ . 'modules/pdfproduct', 'email' => Configuration::get('PS_SHOP_EMAIL'), 'url' => $url, 'address' => Configuration::get('ADDRESS_SHOP'), 'background' => Configuration::get('BACKGROUND')));
     $html = $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'pdfproduct/views/templates/front/custom_template_content.tpl');
     $dompdf = new DOMPDF();
     $dompdf->set_option('enable_remote', TRUE);
     $dompdf->load_html($html);
     $dompdf->set_paper('a4', 'portrait');
     $dompdf->render();
     $dompdf->stream('producto');
     //$this->setTemplate('custom_template_content.tpl');
     //file_put_contents($filename, $dompdf->output());
     //$pdf = new PDF($product, 'CustomPdf', Context::getContext()->smarty);
     //$img_file = Tools::getHttpHost(true).__PS_BASE_URI__. '/modules/pdfproduct/views/images/background.jpg';
     //$pdf->pdf_renderer->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
     //$pdf->render();
 }
开发者ID:hesselek,项目名称:printed_module,代码行数:35,代码来源:controllerPdf.php

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

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

 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

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

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

示例15: Init

 function Init($html)
 {
     require 'pdf/dompdfp.php';
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->set_paper('letter', 'landscape');
     $dompdf->render();
     $dompdf->stream("report.pdf");
 }
开发者ID:fernandoifto,项目名称:appPotigua,代码行数:9,代码来源:pdf.php


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