Example #1
6
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;
            }
        }
    }
}
Example #2
1
 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();
     }
 }
Example #3
1
 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');
 }
Example #4
1
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();
    }
}
 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();
 }
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();
    }
}
 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();
 }
 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('*****@*****.**', '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';
 }
 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);
     }
 }
Example #10
0
 /**
  * Convert data
  *
  * @param   string  $data
  * @return  string
  */
 public function convert($data)
 {
     $dompdf = new DOMPDF();
     $dompdf->load_html($data);
     $dompdf->render();
     return $dompdf->output();
 }
Example #11
0
 /**
  * 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();
 }
Example #12
0
 /**
  * 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();
 }
Example #13
0
 /**
  * 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());
 }
Example #14
0
 /**
  * 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'));
 }
Example #15
0
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;
}
Example #16
0
 /**
  * {@inheritdoc}
  */
 public function output($options = ['compress' => 1])
 {
     $this->render();
     $output = $this->dompdfInstance->output($options);
     if (!is_null($this->filename)) {
         file_put_contents($this->filename, $output);
     }
     return $output;
 }
function render_solid_waste($key)
{
    $data = getDetailFultonWaste($key);
    $dompdf = new DOMPDF();
    $dompdf->load_html($data);
    $dompdf->render();
    $output = $dompdf->output();
    return $output;
}
 function pdf_create($html, $filename, $stream = TRUE)
 {
     $dompdf = new DOMPDF();
     $dompdf->set_paper("A4");
     $dompdf->load_html($html);
     $dompdf->render();
     $canvas = $dompdf->get_canvas();
     // get height and width of page
     $w = $canvas->get_width();
     $h = $canvas->get_height();
     // get font
     $font = Font_Metrics::get_font("helvetica", "normal");
     $txtHeight = Font_Metrics::get_font_height($font, 7);
     //draw line for signature manager
     $mnline = $h - 10 * $txtHeight - 24;
     $colormn = array(0, 0, 0);
     $canvas->line(20, $mnline, $w - 470, $mnline, $colormn, 1);
     //text for signature Requestor/HOD
     $textmn = "Requestor/HOD";
     $widthmn = Font_Metrics::get_text_width($textmn, $font, 12);
     $canvas->text($w - $widthmn - 480, $mnline, $textmn, $font, 12);
     // draw a line along the bottom
     $y = $h - 2 * $txtHeight - 24;
     $color = array(0, 0, 0);
     $canvas->line(16, $y, $w - 16, $y, $color, 1);
     //draw line for GM/Manager
     //$canvas->line(270, $mnline, $w - 240, $mnline, $colormn, 1);
     $canvas->line(330, $mnline, $w - 170, $mnline, $colormn, 1);
     $texthr = "GM/Manager";
     $widthhr = Font_Metrics::get_text_width($texthr, $font, 12);
     $canvas->text($w - $widthmn - 160, $mnline, $texthr, $font, 12);
     //draw line for HR
     //$canvas->line(270, $mnline, $w - 240, $mnline, $colormn, 1);
     $canvas->line(180, $mnline, $w - 310, $mnline, $colormn, 1);
     $texthr = "HR";
     $widthhr = Font_Metrics::get_text_width($texthr, $font, 12);
     $canvas->text($w - $widthmn - 325, $mnline, $texthr, $font, 12);
     //draw line for IT Officer
     $canvas->line(470, $mnline, $w - 20, $mnline, $colormn, 1);
     $textIT = "IT Officer";
     $canvas->text($w - $widthmn - 30, $mnline, $textIT, $font, 12);
     // set page number on the left side
     //$canvas->page_text(16, $y, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 8, $color);
     $canvas->page_text($w - 324, $y, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 8, $color);
     // set additional text
     $text = "ESRNL PORTAL";
     $width = Font_Metrics::get_text_width($text, $font, 8);
     $canvas->text($w - $width - 16, $y, $text, $font, 8);
     if ($stream) {
         $dompdf->stream($filename . ".pdf");
     } else {
         $CI =& get_instance();
         $CI->load->helper('file');
         write_file($filename, $dompdf->output());
     }
 }
 public function getPdf()
 {
     $html = $this->getHtml();
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->render();
     $output = $dompdf->output();
     $pdfFileName = $this->curDir . '/invoice.pdf';
     file_put_contents($pdfFileName, $output);
 }
    function Generate_PDF($invoiceObj, $clientObj, $payments, $items)
    {
        global $sugar_config;
        require_once 'custom/include/dompdf/dompdf_config.inc.php';
        spl_autoload_register('DOMPDF_autoload');
        $img_path = realpath(dirname(__FILE__));
        if ($invoiceObj->company_name == '') {
            $company = $clientObj->company_name_c;
        } else {
            $company = $invoiceObj->company_name;
        }
        // Build HTML
        $html = <<<EOD
\t\t<style>
\t\ttd{
\t\t\tbackground-color:white;
\t\t\tvertical-align:top;
\t\t}
\t\t</style>
\t\t<table style="font-family: helvetica; font-size: 12px; width: 100%;" border="0" cellspacing="10" cellpadding="0">
\t\t<tbody>
\t\t<tr>
\t\t<td colspan=2 align="center"><img src="{$img_path}/TP_TAI_Trans.gif"></td>
\t\t</tr>
\t\t<tr>
\t\t<td width="80%"><h3>TO </h3> {$clientObj->first_name} {$clientObj->last_name} <br /> {$company} <br />{$clientObj->primary_address_street}<br /> {$clientObj->primary_address_city}<br /> {$clientObj->primary_address_state} {$clientObj->primary_address_country} {$clientObj->primary_address_postalcode}</td>
\t\t<td><h3>ADJUSTMENT NOTE </h3> Adjustment : {$invoiceObj->name} <br /> Date : {$invoiceObj->document_date}</td>
\t\t</tr>
\t\t</tbody>
\t\t</table>
\t\t<table style="font-family: helvetica; font-size: 10px; width: 100%;background-color:black;" border="0" cellspacing="2" cellpadding="5">
\t\t<tbody>
\t\t<tr>
\t\t<td><strong>Description</strong></td>
\t\t<td><strong>Item Price (Inc. GST)</strong></td>
\t\t<td><strong>Total Amount (Ex. GST)</strong></td>
\t\t<td><strong>Total GST</strong></td>
\t\t<td><strong>Total Price</strong></td>
\t\t</tr>
EOD;
        foreach ($items as $item) {
            $html .= "\n\t\t<tr>\n\t\t<td>{$item['name']}</td>\n\t\t<td>{$sugar_config['default_currency_symbol']}{$item['price']}</td>\n\t\t<td>{$sugar_config['default_currency_symbol']}{$item['amount_net']}</td>\n\t\t<td>{$sugar_config['default_currency_symbol']}{$item['amount_tax']}</td>\n\t\t<td>{$sugar_config['default_currency_symbol']}{$item['price']}</td>\n\t\t</tr>";
        }
        $html .= "<tr>\n\t\t<td>&nbsp;</td>\n\t\t<td>&nbsp;</td>\n\t\t<td>&nbsp;</td>\n\t\t<td><b>TOTAL</b></td>\n\t\t<td>{$sugar_config['default_currency_symbol']}{$invoiceObj->amount_total}</td>\n\t\t</tr>";
        foreach ($payments as $payment) {
            $paymentdate = date('d-m-Y', strtotime($payment['date']));
            $html .= "<tr>\n\t\t\t<td colspan='4'>Refund REF {$payment['number']} : Payment Refunded ON {$paymentdate} By {$payment['method']}</td>\n\t\t\t<td>{$sugar_config['default_currency_symbol']}{$payment['amount']}</td>\n\t\t\t</tr>";
        }
        $html .= "<tr>\n\t\t<td>&nbsp;</td>\n\t\t<td>&nbsp;</td>\n\t\t<td colspan='3'>All Prices in AUD unless specified otherwise</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td>&nbsp;</td>\n\t\t<td>&nbsp;</td>\n\t\t<td colspan='2'>\n\t\t<b>BALANCE OUTSTANDING</b>\n\t\t</td>\n\t\t<td>{$sugar_config['default_currency_symbol']}{$invoiceObj->amount_remaining}</td>\n\t\t</tr>\n\t\t</tbody>\n\t\t</table>\n\t\t<br><br>\n\t\t<div style='font-family: helvetica; font-size: 10px; width: 100%;'><center>{$sugar_config['company_address']}</center></div>\n\t\t";
        $dompdf = new DOMPDF();
        $dompdf->load_html($html);
        $dompdf->render();
        $pdf = $dompdf->output();
        file_put_contents("cache/invoices/" . $invoiceObj->name . ".pdf", $pdf);
    }
 public final function toPdf()
 {
     define('DOMPDF_ENABLE_AUTOLOAD', false);
     require_once DISPATCHER_REAL_PATH . 'vendor/dompdf/dompdf/dompdf_config.inc.php';
     $dompdf = new \DOMPDF();
     $template = new TemplateBootstrap("basic", "lumen");
     $template->setContent($this->toHtml());
     $dompdf->load_html($template->serialize());
     $dompdf->render();
     return $dompdf->output();
 }
Example #22
0
 /**
  * Lists all pdf entities.
  *
  */
 public function indexAction()
 {
     require_once $this->get('kernel')->getRootDir() . '/config/dompdf_config.inc.php';
     $dompdf = new \DOMPDF();
     $pippo = "antani";
     $htmlfinale = $this->renderView('estarRdaBundle:pdf:index.html.twig', array('pluto' => $pippo));
     //$dompdf->load_html("<html><body><h1>titolo</h1></body></html>");
     $dompdf->load_html($htmlfinale);
     $dompdf->render();
     return new Response($dompdf->output(), 200, array('Content-Type' => 'application/pdf'));
 }
Example #23
0
 /**
  * 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();
 }
 /**
  * Create a PDF using dompdf.
  * 
  * @access public
  * @param string $html the HTML to render (default: '').
  * @param string $filename optional file name to store the pdf (default: '').
  * @param mixed $stream whether or not to stream to browser (default: false).
  * @return mixed the raw PDF output if $stream is true, otherwise the PDF is
  *         streamed to a file.
  */
 function pdf_create($html = '', $filename = '', $stream = false)
 {
     require_once "dompdf/dompdf_config.inc.php";
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->render();
     if (!$stream) {
         $dompdf->stream($filename . ".pdf");
     } else {
         return $dompdf->output();
     }
 }
Example #25
0
function to_pdf($html, $filename = '', $stream = TRUE)
{
    require_once APPPATH . "libraries/dompdf/dompdf_config.inc.php";
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename . ".pdf");
    } else {
        return $dompdf->output();
    }
}
function pdf_create($html, $filename = '', $stream = TRUE)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . "/app/core/system/helpers/dompdf/dompdf_config.inc.php";
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename . ".pdf");
    } else {
        return $dompdf->output();
    }
}
Example #27
0
function pdf_create($html, $filename = '', $stream = TRUE)
{
    require_once "dompdf/dompdf_config.inc.php";
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename . ".pdf", array('Attachment' => 0));
    } else {
        return $dompdf->output();
    }
}
Example #28
0
function pdf_create($html, $filename, $stream = TRUE)
{
    require_once "dompdf/dompdf_config.inc.php";
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename . ".pdf");
    } else {
        write_file("./invoices_temp/invoice_{$filename}.pdf", $dompdf->output());
    }
}
Example #29
-1
 /**
  * Effectue le rendu du contenu html en pdf
  * 
  * @return void
  */
 function render()
 {
     $this->dompdf->load_html($this->html);
     $this->dompdf->render();
     if (CHtmlToPDFConverter::$_page_ordonnance) {
         $this->dompdf->get_canvas()->page_text(273, 730, "Page {PAGE_NUM} / {PAGE_COUNT}", Font_Metrics::get_font("arial"), 10);
     }
     $this->result = $this->dompdf->output();
 }
Example #30
-4
File: Pdf.php Project: ibnoe/dms
 function pdf_create($html, $filename = '', $stream = FALSE)
 {
     require_once APPPATH . "third-party/dompdf_config.inc.php";
     //Require Loader Class n Config
     spl_autoload_register('DOMPDF_autoload');
     //Autoload Resource
     ini_set("memory_limit", "999M");
     ini_set("max_execution_time", "999");
     $dompdf = new DOMPDF();
     //Instansiasi
     $dompdf->load_html($html);
     //Load HTML File untuk dirender
     //   $dompdf->set_base_path(realpath($css));
     $dompdf->set_paper(array(0, 0, 8.5 * 72, 13.5 * 72), "portrait");
     //array(0,0, 8.5 * 72, 11 * 72)
     $dompdf->render();
     //Proses Rendering File
     $canvas = $dompdf->get_canvas();
     $font = Font_Metrics::get_font("helvetica", "bold");
     $canvas->page_text(830, 578, "Halaman: {PAGE_NUM} dari {PAGE_COUNT}", $font, 8, array(0, 0, 0));
     if ($stream == TRUE) {
         $dompdf->stream($filename, array('Attachment' => 0));
     } else {
         $CI =& get_instance();
         $CI->load->helper('file');
         write_file($filename, $dompdf->output());
         //file name adalah ABSOLUTE PATH dari tempat menyimpan file PDF
     }
 }