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


PHP DOMPDF::set_base_path方法代码示例

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


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

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

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

 /**
  *
  * @param \Illuminate\Config\Repository $config
  * @param \Illuminate\Filesystem\Filesystem $files
  * @param \Illuminate\View\Factory $view
  * @param string $publicPath
  */
 public function __construct(ConfigRepository $config, Filesystem $files, $view, $publicPath)
 {
     $this->config = $config;
     $this->files = $files;
     $this->view = $view;
     $this->public_path = $publicPath;
     $this->showWarnings = $this->config->get('laravel-dompdf::show_warnings', false);
     //To prevent old configs from not working..
     if ($this->config->has('laravel-dompdf::paper')) {
         $this->paper = $this->config->get('laravel-dompdf::paper');
     } else {
         $this->paper = DOMPDF_DEFAULT_PAPER_SIZE;
     }
     $this->orientation = $this->config->get('laravel-dompdf::orientation') ?: 'portrait';
     $this->dompdf = new \DOMPDF();
     $this->dompdf->set_base_path(realpath($publicPath));
 }
开发者ID:heruujoko,项目名称:tsel-net-management,代码行数:24,代码来源:PDF.php

示例4: getPDF

 /**
  * gerar PDF da Danfe.
  *
  * @param null $encoding
  * @return string
  */
 public function getPDF($encoding = null)
 {
     require_once __DIR__ . '/DomPDF/bootstrap.php';
     $html = $this->getHTML();
     $html = $this->convertEntities($html);
     $pdf = new \DOMPDF();
     $pdf->set_base_path(__DIR__);
     $pdf->load_html($html);
     $pdf->set_paper('A4', 'portrait');
     $pdf->render();
     return $pdf->output();
 }
开发者ID:phpnfe,项目名称:nfe,代码行数:18,代码来源:DanfeCC.php

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

示例6: register

 /**
  * Register the service provider.
  *
  * @throws \Exception
  * @return void
  */
 public function register()
 {
     $configPath = __DIR__ . '/../config/dompdf.php';
     $this->mergeConfigFrom($configPath, 'dompdf');
     $this->app->bind('dompdf', function ($app) {
         $dompdf = new \DOMPDF();
         $dompdf->set_base_path(realpath(base_path('public')));
         return $dompdf;
     });
     $this->app->alias('dompdf', 'DOMPDF');
     $this->app->bind('dompdf.wrapper', function ($app) {
         return new PDF($app['dompdf'], $app['config'], $app['files'], $app['view']);
     });
 }
开发者ID:olivierneo,项目名称:laravel-dompdf,代码行数:20,代码来源:ServiceProvider.php

示例7: pdf_create

function pdf_create($html, $filename = '', $stream = TRUE)
{
    require_once "dompdf/dompdf_config.inc.php";
    $new_filename = str_replace("/", "_", $filename);
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->set_base_path(base_url() . 'assets/css/style-surat.css');
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($new_filename . ".pdf");
    } else {
        //return $dompdf->output();
        $output = $dompdf->output();
        $file_to_save = FCPATH . 'assets/surat_acara/' . $new_filename . '.pdf';
        file_put_contents($file_to_save, $output);
    }
}
开发者ID:sugihartono,项目名称:ci_event,代码行数:17,代码来源:dompdf_helper.php

示例8: print_pdf

function print_pdf($filename, $html, $force_download, $paper_size = "A4", $orientation = "portrait")
{
    //$CI =& get_instance();
    //$CI->load->library('Pdflib');
    require_once APPPATH . "/third_party/dompdf/dompdf_config.inc.php";
    ob_start();
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->set_base_path(base_url() . 'inc/css/');
    $dompdf->set_paper($paper_size, $orientation);
    $dompdf->render();
    if ($force_download) {
        $dompdf->stream($filename . ".pdf");
    } else {
        $dompdf->stream($filename . ".pdf", array('Attachment' => 0));
    }
}
开发者ID:indrapermadi21,项目名称:bpmtbv1,代码行数:17,代码来源:self_helper.php

示例9: 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';
         $preData = null;
         $postData = null;
         extract($this->viewVars, EXTR_IF_EXISTS);
         $dompdf = new DOMPDF();
         $dompdf->set_protocol('');
         $dompdf->set_protocol(WWW_ROOT);
         $dompdf->set_base_path('/');
         $dompdf->set_paper($paperSize, $paperOrientation);
         if (!empty($preData) || !empty($postData)) {
             App::import('Vendor', 'Dompdf.PDFMerger', true, array(), 'PDFMerger' . DS . 'PDFMerger.php');
             $merger = new PDFMerger();
             if (!empty($preData)) {
                 $merger->addPdfData($preData, DOMPDF_TEMP_DIR);
             }
             //Get the static information sheet
             $merger->addPdfData(file_get_contents("../View/Courses/survey_explanation.pdf"), DOMPDF_TEMP_DIR);
             if (!empty($postData)) {
                 $merger->addPdfData($postData, DOMPDF_TEMP_DIR);
             }
             $merger->merge($download ? 'download' : 'browser');
         } else {
             $dompdf->stream($name, array('Attachment' => $download));
         }
     } catch (Exception $e) {
         $this->request->params['ext'] = 'html';
         throw $e;
     }
 }
开发者ID:byu-oit-appdev,项目名称:student-ratings,代码行数:44,代码来源:PdfView.php

示例10: actionIndex

 /**
  * @return string
  */
 public function actionIndex()
 {
     $model = new ApplicantForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $fileName = time() . '.pdf';
         $filePath = Yii::getAlias('@webroot/files/' . time() . '.pdf');
         $this->layout = 'pdf';
         $this->view->params['css'] = [file_get_contents(Yii::getAlias('@webroot/css/pdf.css'))];
         $html = $this->render('pdf', ['model' => $model]);
         $pdf = new \DOMPDF();
         $pdf->set_base_path(Yii::$app->assetManager->getBundle(BootstrapAsset::className())->basePath . '/css');
         $pdf->load_html($html);
         $pdf->render();
         $output = $pdf->output();
         file_put_contents($filePath, $output);
         Yii::$app->session->setFlash('reportGenerated');
         Yii::$app->session->setFlash('reportURL', Url::to(['files/' . $fileName]));
         return $this->refresh();
     }
     return $this->render('index', ['model' => $model]);
 }
开发者ID:hauntd,项目名称:form-to-pdf,代码行数:24,代码来源:SiteController.php

示例11: OnlineStore_invoicePdf

/**
 * get a PDF version of the invoice
 *
 * @return null
 */
function OnlineStore_invoicePdf()
{
    $id = (int) $_REQUEST['id'];
    $order = dbRow('select invoice, meta, user_id from online_store_orders where id=' . $id);
    $ok = false;
    if ($order) {
        if ($order['user_id'] == $_SESSION['userdata']['id']) {
            $ok = true;
        }
        $meta = json_decode($order['meta'], true);
        if (isset($_REQUEST['auth']) && isset($meta['auth-md5']) && $meta['auth-md5'] == $_REQUEST['auth']) {
            $ok = true;
        }
    }
    if (!$ok) {
        Core_quit();
    }
    $inv = $order['invoice'];
    // { check if it's already stored as a PDF
    if (isset($meta['invoice-type']) && $meta['invoice-type'] == 'pdf') {
        $pdf = base64_decode($inv);
        header('Content-type: application/pdf');
        echo $pdf;
        Core_quit();
    }
    // }
    // { else generate a PDF and output it
    $pdfFile = USERBASE . '/ww.cache/online-store/invoice-pdf-' . $id;
    if (!file_exists($pdfFile)) {
        $html = OnlineStore_invoiceGet($id);
        require_once $_SERVER['DOCUMENT_ROOT'] . '/ww.incs/dompdf/dompdf_config.inc.php';
        $dompdf = new DOMPDF();
        $dompdf->set_base_path($_SERVER['DOCUMENT_ROOT']);
        $dompdf->load_html(utf8_decode(str_replace('€', '€', $html)), 'UTF-8');
        $dompdf->set_paper('a4');
        $dompdf->render();
        file_put_contents($pdfFile, $dompdf->output());
    }
    header('Content-type: application/pdf');
    $fp = fopen($pdfFile, 'r');
    fpassthru($fp);
    fclose($fp);
    Core_quit();
    // }
}
开发者ID:raylouis,项目名称:kvwebme,代码行数:50,代码来源:api.php

示例12: DOMPDF

 function _formatOutput($content = '', $return = FALSE)
 {
     if ($this->request_type == 'pdf') {
         $this->output->set_header('Content-Type: text/html');
         require_once DOCROOT . '/' . APPPATH . 'libraries/dompdf/dompdf_config.inc.php';
         $output = $this->layout->wrap($content, $return);
         $title = $this->layout->getTitle() . '.pdf';
         if ($this->input->get('output')) {
             echo $output;
         } else {
             $dompdf = new DOMPDF();
             $dompdf->set_base_path(DOCROOT);
             $dompdf->load_html($output);
             $dompdf->render();
             $dompdf->stream($title);
         }
     } else {
         $this->layout->addMeta('author', $this->SITE_CONF['author']);
         $this->layout->addMeta('generator', $this->SITE_CONF['application_name'] . ' ' . $this->SITE_CONF['application_version']);
         $this->layout->addMeta('cms', $this->SITE_CONF['application']);
         $this->layout->addMeta('cms-version', $this->SITE_CONF['application_version']);
         $this->layout->addMeta('cms-pagegenerated', date(DATE_DB_FORMAT));
         $this->layout->addMeta('cms-sitepath', SITEPATH);
         $this->layout->addMeta('cms-requestpath', $this->request_path);
         $output = $this->layout->wrap($content, $return);
         if ($return) {
             return $output;
         } else {
             echo $output;
         }
     }
 }
开发者ID:vsa-partners,项目名称:typologycms,代码行数:32,代码来源:website.php

示例13: _genExport

 /**
  * Generate  export file of current result
  */
 protected function _genExport($pt_subject, $ps_template, $ps_output_filename, $ps_title = null)
 {
     $this->view->setVar('t_subject', $pt_subject);
     if (substr($ps_template, 0, 5) === '_pdf_') {
         $va_template_info = caGetPrintTemplateDetails('summary', substr($ps_template, 5));
     } elseif (substr($ps_template, 0, 9) === '_display_') {
         $vn_display_id = substr($ps_template, 9);
         $t_display = new ca_bundle_displays($vn_display_id);
         if ($vn_display_id && $t_display->haveAccessToDisplay($this->request->getUserID(), __CA_BUNDLE_DISPLAY_READ_ACCESS__)) {
             $this->view->setVar('t_display', $t_display);
             $this->view->setVar('display_id', $vn_display_id);
             $va_display_list = array();
             $va_placements = $t_display->getPlacements(array('settingsOnly' => true));
             foreach ($va_placements as $vn_placement_id => $va_display_item) {
                 $va_settings = caUnserializeForDatabase($va_display_item['settings']);
                 // get column header text
                 $vs_header = $va_display_item['display'];
                 if (isset($va_settings['label']) && is_array($va_settings['label'])) {
                     $va_tmp = caExtractValuesByUserLocale(array($va_settings['label']));
                     if ($vs_tmp = array_shift($va_tmp)) {
                         $vs_header = $vs_tmp;
                     }
                 }
                 $va_display_list[$vn_placement_id] = array('placement_id' => $vn_placement_id, 'bundle_name' => $va_display_item['bundle_name'], 'display' => $vs_header, 'settings' => $va_settings);
             }
             $this->view->setVar('placements', $va_display_list);
         } else {
             $this->postError(3100, _t("Invalid format %1", $ps_template), "DetailController->_genExport()");
             return;
         }
         $va_template_info = caGetPrintTemplateDetails('summary', 'summary');
     } else {
         $this->postError(3100, _t("Invalid format %1", $ps_template), "DetailController->_genExport()");
         return;
     }
     //
     // PDF output
     //
     if (!is_array($va_template_info)) {
         $this->postError(3110, _t("Could not find view for PDF"), "DetailController->_genExport()");
         return;
     }
     //
     // Tag substitution
     //
     // Views can contain tags in the form {{{tagname}}}. Some tags, such as "itemType" and "detailType" are defined by
     // the detail controller. More usefully, you can pull data from the item being detailed by using a valid "get" expression
     // as a tag (Eg. {{{ca_objects.idno}}}. Even more usefully for some, you can also use a valid bundle display template
     // (see http://docs.collectiveaccess.org/wiki/Bundle_Display_Templates) as a tag. The template will be evaluated in the
     // context of the item being detailed.
     //
     $va_defined_vars = array_keys($this->view->getAllVars());
     // get list defined vars (we don't want to copy over them)
     $va_tag_list = $this->getTagListForView($va_template_info['path']);
     // get list of tags in view
     foreach ($va_tag_list as $vs_tag) {
         if (in_array($vs_tag, $va_defined_vars)) {
             continue;
         }
         if (strpos($vs_tag, "^") !== false || strpos($vs_tag, "<") !== false) {
             $this->view->setVar($vs_tag, $pt_subject->getWithTemplate($vs_tag, array('checkAccess' => $this->opa_access_values)));
         } elseif (strpos($vs_tag, ".") !== false) {
             $this->view->setVar($vs_tag, $pt_subject->get($vs_tag, array('checkAccess' => $this->opa_access_values)));
         } else {
             $this->view->setVar($vs_tag, "?{$vs_tag}");
         }
     }
     try {
         $this->view->setVar('base_path', $vs_base_path = pathinfo($va_template_info['path'], PATHINFO_DIRNAME));
         $this->view->addViewPath(array($vs_base_path, "{$vs_base_path}/local"));
         $vs_content = $this->render($va_template_info['path']);
         $o_dompdf = new DOMPDF();
         $o_dompdf->load_html($vs_content);
         $o_dompdf->set_paper(caGetOption('pageSize', $va_template_info, 'letter'), caGetOption('pageOrientation', $va_template_info, 'portrait'));
         $o_dompdf->set_base_path(caGetPrintTemplateDirectoryPath('summary'));
         $o_dompdf->render();
         $o_dompdf->stream(caGetOption('filename', $va_template_info, 'export_results.pdf'));
         $vb_printed_properly = true;
     } catch (Exception $e) {
         $vb_printed_properly = false;
         $this->postError(3100, _t("Could not generate PDF"), "DetailController->_genExport()");
     }
     return;
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:87,代码来源:DetailController.php

示例14: getSpBloques

    $arrBloques = $oDocumento->getBloquesDoc();
    $arrSPBloques = getSpBloques($oDocumento, $arrBloques);
}
if (!empty($arrSPBloques)) {
    $arrCamposBloque = $oDocumento->getCamposBloque($arrSPBloques[0]);
    $arrItemsBloque = $oDocumento->getCamposBloque($arrSPBloques[1]);
    $arrTotales = $oDocumento->getCamposBloque($arrSPBloques[2]);
    $TPLOrden = getCamposTPL($arrCamposBloque[0], $arrItemsBloque, $arrTotales[0]);
    $dompdf = new DOMPDF();
    $dompdf->load_html($TPLOrden);
    /*
    ini_set("max_execution_time","2500");
    ini_set("max_input_time","180");
    ini_set("memory_limit","200M");     
    */
    $dompdf->set_base_path("pdfstyles.css");
    $dompdf->render();
    $array_opciones = array("afichero" => 1, "compress" => 1);
    $dompdf->stream("orden_de_reparacion.pdf", $array_opciones);
    /*
    $tmpfile = tempnam("/tmp", "dompdf_");
    file_put_contents($tmpfile, $TPLOrden); // Replace $smarty->fetch()// with your HTML string
    $url = "PE/PDFGEN/dompdf/dompdf.php?input_file=" . rawurlencode($tmpfile) . 
           "&paper=letter&output_file=" . rawurlencode("My Fancy PDF.pdf");
    header("Location: http://localhost/jc_zurich_dcs/$url");
    */
}
/**
 * Retorno array con stores procedures listos para ejecutar.
 * @param array $arrBloques 
 */
开发者ID:rodolfobais,项目名称:proylectura,代码行数:31,代码来源:index_new2.php

示例15: PrintSummary

 /**
  * Generates display summary of record data based upon a bundle display for print (PDF)
  *
  * @param array $pa_options Array of options passed through to _initView 
  */
 public function PrintSummary($pa_options = null)
 {
     AssetLoadManager::register('tableList');
     list($vn_subject_id, $t_subject) = $this->_initView($pa_options);
     if (!$this->_checkAccess($t_subject)) {
         return false;
     }
     $t_display = new ca_bundle_displays();
     $va_displays = $t_display->getBundleDisplays(array('table' => $t_subject->tableNum(), 'user_id' => $this->request->getUserID(), 'access' => __CA_BUNDLE_DISPLAY_READ_ACCESS__, 'restrictToTypes' => array($t_subject->getTypeID())));
     if (!($vn_display_id = $this->request->getParameter('display_id', pInteger)) || !isset($va_displays[$vn_display_id])) {
         if (!($vn_display_id = $this->request->user->getVar($t_subject->tableName() . '_summary_display_id')) || !isset($va_displays[$vn_display_id])) {
             $va_tmp = array_keys($va_displays);
             $vn_display_id = $va_tmp[0];
         }
     }
     $this->view->setVar('t_display', $t_display);
     $this->view->setVar('bundle_displays', $va_displays);
     // Check validity and access of specified display
     if ($t_display->load($vn_display_id) && $t_display->haveAccessToDisplay($this->request->getUserID(), __CA_BUNDLE_DISPLAY_READ_ACCESS__)) {
         $this->view->setVar('display_id', $vn_display_id);
         $va_placements = $t_display->getPlacements(array('returnAllAvailableIfEmpty' => true, 'table' => $t_subject->tableNum(), 'user_id' => $this->request->getUserID(), 'access' => __CA_BUNDLE_DISPLAY_READ_ACCESS__, 'no_tooltips' => true, 'format' => 'simple', 'settingsOnly' => true));
         $va_display_list = array();
         foreach ($va_placements as $vn_placement_id => $va_display_item) {
             $va_settings = caUnserializeForDatabase($va_display_item['settings']);
             // get column header text
             $vs_header = $va_display_item['display'];
             if (isset($va_settings['label']) && is_array($va_settings['label'])) {
                 if ($vs_tmp = array_shift(caExtractValuesByUserLocale(array($va_settings['label'])))) {
                     $vs_header = $vs_tmp;
                 }
             }
             $va_display_list[$vn_placement_id] = array('placement_id' => $vn_placement_id, 'bundle_name' => $va_display_item['bundle_name'], 'display' => $vs_header, 'settings' => $va_settings);
         }
         $this->view->setVar('placements', $va_display_list);
         $this->request->user->setVar($t_subject->tableName() . '_summary_display_id', $vn_display_id);
         $vs_format = $this->request->config->get("summary_print_format");
     } else {
         $this->view->setVar('display_id', null);
         $this->view->setVar('placements', array());
     }
     //
     // PDF output
     //
     if (!is_array($va_template_info = caGetPrintTemplateDetails('summary', "{$this->ops_table_name}_summary"))) {
         if (!is_array($va_template_info = caGetPrintTemplateDetails('summary', "summary"))) {
             $this->postError(3110, _t("Could not find view for PDF"), "BaseEditorController->PrintSummary()");
             return;
         }
     }
     $va_barcode_files_to_delete = array();
     try {
         $this->view->setVar('base_path', $vs_base_path = pathinfo($va_template_info['path'], PATHINFO_DIRNAME));
         $this->view->addViewPath(array($vs_base_path, "{$vs_base_path}/local"));
         $va_barcode_files_to_delete += caDoPrintViewTagSubstitution($this->view, $t_subject, $va_template_info['path'], array('checkAccess' => $this->opa_access_values));
         $vs_content = $this->render($va_template_info['path']);
         $o_dompdf = new DOMPDF();
         $o_dompdf->load_html($vs_content);
         $o_dompdf->set_paper(caGetOption('pageSize', $va_template_info, 'letter'), caGetOption('pageOrientation', $va_template_info, 'portrait'));
         $o_dompdf->set_base_path(caGetPrintTemplateDirectoryPath('summary'));
         $o_dompdf->render();
         $o_dompdf->stream(caGetOption('filename', $va_template_info, 'print_summary.pdf'));
         $vb_printed_properly = true;
         foreach ($va_barcode_files_to_delete as $vs_tmp) {
             @unlink($vs_tmp);
         }
     } catch (Exception $e) {
         foreach ($va_barcode_files_to_delete as $vs_tmp) {
             @unlink($vs_tmp);
         }
         $vb_printed_properly = false;
         $this->postError(3100, _t("Could not generate PDF"), "BaseEditorController->PrintSummary()");
     }
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:78,代码来源:BaseEditorController.php


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