本文整理汇总了PHP中DOMPDF::set_protocol方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMPDF::set_protocol方法的具体用法?PHP DOMPDF::set_protocol怎么用?PHP DOMPDF::set_protocol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMPDF
的用法示例。
在下文中一共展示了DOMPDF::set_protocol方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例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"]);
}
}
示例3: gerarpdf
public function gerarpdf($idCi)
{
require_once "../helpers/dompdf/dompdf_config.inc.php";
$ci = Viewci::get($idCi);
if ($ci) {
$html = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="Stylesheet" type="text/css" href="' . ROOT_VIRTUAL . '/css/style-cipdf.css" /> </head>';
for ($i = 1; $i <= 2; $i++) {
$observacoes = Viewobservacao::allByCi($ci->Id);
$html .= '<body><center> <b>' . $i . 'º Via </b> Data:' . date('d/m/Y H:i:s', time()) . '</center><table style="margin:auto;" class="bordasimples">' . '<tbody>' . '<tr>' . '<th rowspan=4><img src="' . ROOT_VIRTUAL . 'img/logo-ulbra.png" width="50%"/></th>' . '<td><b>Data: </b>' . date('d/m/Y', $ci->Data) . '</td>' . '</tr>
<tr><td><b>Assunto: </b>' . $ci->Assunto . '</td></tr>' . '<tr><td><b>De: </b>' . $ci->NomeDe . ' </td></tr>' . '<tr><td><b>Para: </b>' . $ci->NomePara . '</td></tr>' . '<tr><td colspan="2">' . $ci->Conteudo . '<br><br>Atenciosamente, <br><br><center>' . $ci->NomeUsuarioAtenciosamente . '</center><center>' . $ci->CargoUsuarioAtenciosamente . '</center><br></td></tr>' . '</tbody>' . '</table >';
if ($observacoes) {
$html .= '<center><h3>Observações</h3></center><table style="margin:auto;" class="bordasimples" width="80%"> <tbody>';
foreach ($observacoes as $ob) {
$html .= '
<tr>
<td>' . $ob->Nome . ' - ' . date('d/m/Y H:i', $ob->Data) . '</td>
</tr><tr><td>' . $ob->Conteudo . '</td>
</tr>';
}
$html .= '</table>';
}
$html .= '<br><br><hr><br>';
}
$html .= '</body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->set_host('localhost');
$dompdf->set_protocol('http://');
$dompdf->render();
$dompdf->stream("sample.pdf");
} else {
$this->_flash('alert alert-error fade in', 'CI não encontrada');
}
exit;
}
示例4: 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;
}
}