本文整理汇总了PHP中DOMPDF::output方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMPDF::output方法的具体用法?PHP DOMPDF::output怎么用?PHP DOMPDF::output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMPDF
的用法示例。
在下文中一共展示了DOMPDF::output方法的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;
}
}
}
}
示例2: 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();
}
}
示例3: 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();
}
}
示例4: render
function render()
{
$document = Document::find($_SESSION['document_id']);
$this->html = file_get_contents('app/views/render/header.pdf.php');
$this->html .= '<div id="cover">
<img src="public/uploads/' . $document->logo . '">
<h1>' . $document->name . '</h1>
<div style="position: fixed; bottom: 50px;">
<h3>LONDRINA - PR</h3>
<h3>' . $document->year . '</h3>
</div>
</div>';
$this->html .= file_get_contents('app/views/render/logos.pdf.php');
$counter = 0;
foreach ($this->sections as $section => $subs) {
$model = Document::find($_SESSION['document_id'])->{$section};
$counter = floor($counter) + 1;
foreach ($subs as $label => $name) {
if ($label == 'swot') {
$this->render_swot($model);
} else {
$this->html .= '<h2>' . $counter . " {$name}</h2><p>" . $model->{$label} . "</p>";
$counter += 0.1;
}
}
}
$this->html .= '</div></body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($this->html);
$dompdf->render();
header('Content-Type: application/pdf');
echo $dompdf->output();
}
示例5: create_pdf
function create_pdf($data, $filename = '', $stream = TRUE, $papersize = 'letter', $orientation = 'portrait')
{
require_once "dompdf/dompdf_config.inc.php";
$dompdf = new DOMPDF();
$dompdf->load_html(' ');
$dompdf->render();
$canvas = $dompdf->get_canvas();
$font = Font_Metrics::get_font("helvetica");
$fontBold = Font_Metrics::get_font("helvetica", "bold");
$row = 1;
$y = 25;
for ($i = 0; $i < count($data); $i++) {
if (strpos($data[$i], "STUDENT") !== FALSE) {
$canvas->text(40, $y += 15, $data[$i], $fontBold, 10, array(0, 0, 0));
} elseif (strpos($data[$i], "COLLEGE") !== FALSE || strpos($data[$i], "UNIVERSITY") !== FALSE) {
$canvas->text(40, $y += 15, $data[$i], $fontBold, 10, array(0, 0, 0));
} elseif (strpos($data[$i], "__") !== FALSE || $data[$i] == " ") {
$canvas->text(40, $y += 9, $data[$i], $font, 10, array(0, 0, 0));
} else {
$canvas->text(40, $y += 15, $data[$i], $font, 10, array(0, 0, 0));
}
if ($y > 730) {
$dompdf->get_canvas()->new_page();
$y = 50;
}
}
if ($stream) {
$dompdf->stream($filename . ".pdf");
} else {
return $dompdf->output();
}
}
示例6: get_dom_pdf
public function get_dom_pdf()
{
$this->load->helper('dompdf_helper');
$this->load->library('users/auth');
if (isset($_POST) && $this->auth->is_logged_in()) {
$html_content = '<style type="text/css">td{ color : #FF0000;}</style>';
$html_content .= $_POST['content'];
$file_name = $_POST['filename'];
$stream = false;
dompdf();
$dompdf = new DOMPDF();
$dompdf->load_html($html_content);
$dompdf->render();
if ($stream) {
$dompdf->stream($file_name . ".pdf");
} else {
//return $dompdf->output();
$output = $dompdf->output();
$file_to_save = 'temp/' . $file_name . '.pdf';
file_put_contents($file_to_save, $output);
}
$this->output->set_content_type('application/json')->set_output(json_encode($html_content));
return true;
}
return false;
Template::render('drhil02/ajax');
}
示例7: render
function render()
{
$document = Document::find($_SESSION['document_id']);
$html = file_get_contents('app/views/render/header.pdf.php');
$html .= '<div id="cover">
<img src="public/uploads/' . $document->logo . '">
<h1>' . "Plano Diretor de Tecnologia da Informação da Prefeitura Municipal de Guaraci" . '</h1>
<h3>LONDRINA - PR</h3>
<h3>' . $document->year . '</h3>
</div>';
$html .= file_get_contents('app/views/render/logos.pdf.php');
foreach ($this->sections as $section => $subs) {
$model = Document::find($_SESSION['document_id'])->{$section}();
$counter = 1;
foreach ($subs as $label => $name) {
$html .= '<h2>' . $counter . " {$name}</h2><p>" . $model->{$label} . "</p>";
$counter += 0.1;
}
}
$html .= '</div></body></html>';
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
header('Content-Type: application/pdf');
echo $dompdf->output();
}
示例8: rebuild_pdf_application
public function rebuild_pdf_application($uid)
{
$this->load->library('dompdf');
$this->mongo_db->switch_db('gwc');
$this->mongo_db->where('uid', $uid);
$app_data = $this->mongo_db->get('applications');
$dompdf = new DOMPDF();
$dompdf->load_html($this->load->view('alt_export_pdf', array('post' => $app_data[0]), TRUE));
$dompdf->render();
$pdf_filename = time() . '_' . $uid . '.pdf';
$fp = @fopen("../pdf/{$pdf_filename}", 'w');
if ($fp != false) {
fwrite($fp, $dompdf->output(0));
fclose($fp);
$this->mongo_db->switch_db('gwc');
$this->mongo_db->where('uid', $uid);
$this->mongo_db->set('pdf_filename', $pdf_filename);
$this->mongo_db->update('applications');
return 'success';
} else {
$this->load->library('email');
$this->email->from('no_reply@learninghouse.com', 'student portal');
$this->email->to($this->config->item('rebuild_pdf_email'));
$this->email->subject('Student Portal Error');
$this->email->message('Student portal tried to REBUILD a pdf but the PDF dir is not writtable. Please check PDF permissions. -' . $_SERVER['HTTP_HOST']);
$this->email->send();
$pdf_filename = 'failed';
}
$this->mongo_db->switch_db('gwc');
$this->mongo_db->where('uid', $uid);
$this->mongo_db->set('pdf_filename', $pdf_filename);
$this->mongo_db->update('applications');
return 'failed';
}
示例9: 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);
}
}
示例10: convert
/**
* Convert data
*
* @param string $data
* @return string
*/
public function convert($data)
{
$dompdf = new DOMPDF();
$dompdf->load_html($data);
$dompdf->render();
return $dompdf->output();
}
示例11: output
/**
* Output the PDF as a string.
*
* @return string The rendered PDF as string
*/
public function output()
{
if (!$this->rendered) {
$this->render();
}
return $this->dompdf->output();
}
示例12: 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();
}
示例13: transform
/**
* This method combines the ProjectDescriptor and the given target template
* and creates a static html page at the artifact location.
*
* @param ProjectDescriptor $project Document containing the structure.
* @param Transformation $transformation Transformation to execute.
*
* @return void
*/
public function transform(ProjectDescriptor $project, Transformation $transformation)
{
parent::transform($project, $transformation);
$dompdf = new \DOMPDF();
$dompdf->load_html(file_get_contents($this->destinationPath));
$dompdf->render();
file_put_contents($transformation->getTransformer()->getTarget() . DIRECTORY_SEPARATOR . $transformation->getArtifact(), $dompdf->output());
}
示例14: output
/**
* Create a Symfony Response (attachment/inline)
*
* @param $filename
* @param $disposition
* @return \Symfony\Component\HttpFoundation\Response
*/
protected function output($filename, $disposition)
{
if (!$this->rendered) {
$this->render();
}
$output = $this->dompdf->output();
return \Response::make($output, 200, array('Content-Type' => 'application/pdf', 'Content-Description' => 'File Transfer', 'Content-Transfer-Encoding' => 'binary', 'Content-Disposition' => $disposition . '; filename="' . $filename . '"', 'Content-Length' => strlen($output), 'Accept-Ranges' => 'bytes', 'Pragma' => 'public', 'Expires' => 0, 'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0'));
}
示例15: pdf_create
function pdf_create($html, $filename = '', $stream = TRUE)
{
require_once "dompdf/dompdf_config.inc.php";
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$pdf = $dompdf->output();
return $pdf;
}