本文整理汇总了PHP中DOMPDF::set_host方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMPDF::set_host方法的具体用法?PHP DOMPDF::set_host怎么用?PHP DOMPDF::set_host使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMPDF
的用法示例。
在下文中一共展示了DOMPDF::set_host方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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"]);
}
}
示例2: 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;
}