Beispiel #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;
            }
        }
    }
}
 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;
     }
 }
Beispiel #3
4
    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;
    }
Beispiel #4
2
 public static function render($file, $html)
 {
     //generate some PDFs!
     $dompdf = new DOMPDF();
     //if you use namespaces you may use new \DOMPDF()
     $dompdf->load_html($html);
     $dompdf->setPaper('A5', 'landscape');
     $dompdf->render();
     $dompdf->stream($file . ".pdf", array("Attachment" => 0));
 }
Beispiel #5
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('/á/', '&aacute;', $html);
     $html = preg_replace('/(Á)/', '&Aacute;', $html);
     $html = preg_replace('/é/', '&eacute;', $html);
     $html = preg_replace('/(É)/', '&Eacute;', $html);
     $html = preg_replace('/í/', '&iacute;', $html);
     $html = preg_replace('/(Í)/', '&Iacute;', $html);
     $html = preg_replace('/ó/', '&oacute;', $html);
     $html = preg_replace('/(Ó)/', '&Oacute;', $html);
     $html = preg_replace('/ú/', '&uacute;', $html);
     $html = preg_replace('/(Ú)/', '&Uacute;', $html);
     $html = preg_replace('/(ñ)/', '&ntilde;', $html);
     $html = preg_replace('/(Ñ)/', '&Ntilde;', $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();
     }
 }
Beispiel #6
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');
 }
function pdf_create($html, $filename = '', $paper, $orientation, $stream = TRUE)
{
    require_once "dompdf/dompdf_config.inc.php";
    $dompdf = new DOMPDF();
    $dompdf->set_paper($paper, $orientation);
    $dompdf->load_html($html);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename . ".pdf", array("Attachment" => 0));
    } else {
        $dompdf->stream($filename . ".pdf");
    }
    // For download
}
 public function initContent()
 {
     parent::initContent();
     $id = $_GET['id'];
     $id_lang = $this->context->language->id;
     $product = new Product((int) $id);
     $link = new Link();
     $url = $link->getProductLink($product);
     $features = Db::getInstance()->ExecuteS('
 		SELECT fl.name feature_name, fvl.value feature_value
 		FROM ' . _DB_PREFIX_ . 'feature_product fp
 		LEFT JOIN ' . _DB_PREFIX_ . 'feature_lang fl ON (fl.id_feature = fp.id_feature AND fl.id_lang=' . $id_lang . ' )
 		LEFT JOIN ' . _DB_PREFIX_ . 'feature_value_lang fvl ON (fvl.id_feature_value = fp.id_feature_value AND fvl.id_lang=' . $id_lang . ')
 		WHERE fp.id_product=' . $id);
     //	print_r($features);
     $images = Image::getImages((int) $id_lang, (int) $product->id);
     //Limitamos el numero de fotos a cuatro solamente
     while (count($images) > 3) {
         $var = array_pop($images);
     }
     $this->context->smarty->assign(array('product' => $product, 'lang' => $id_lang, 'image' => $images, 'dir' => Tools::getHttpHost(true) . __PS_BASE_URI__ . 'modules/pdfproduct', 'email' => Configuration::get('PS_SHOP_EMAIL'), 'url' => $url, 'address' => Configuration::get('ADDRESS_SHOP'), 'background' => Configuration::get('BACKGROUND')));
     $html = $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'pdfproduct/views/templates/front/custom_template_content.tpl');
     $dompdf = new DOMPDF();
     $dompdf->set_option('enable_remote', TRUE);
     $dompdf->load_html($html);
     $dompdf->set_paper('a4', 'portrait');
     $dompdf->render();
     $dompdf->stream('producto');
     //$this->setTemplate('custom_template_content.tpl');
     //file_put_contents($filename, $dompdf->output());
     //$pdf = new PDF($product, 'CustomPdf', Context::getContext()->smarty);
     //$img_file = Tools::getHttpHost(true).__PS_BASE_URI__. '/modules/pdfproduct/views/images/background.jpg';
     //$pdf->pdf_renderer->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
     //$pdf->render();
 }
Beispiel #9
0
function PDFStop($handle)
{
    global $OutputType, $htmldocAssetsPath;
    if ($OutputType == "PDF") {
        $html = ob_get_contents();
        ob_end_clean();
        $html = '<HTML><BODY>' . $html . '</BODY></HTML>';
        require_once "dompdf/dompdf_config.inc.php";
        //require_once("convertcharset/ConvertCharset.class.php");
        //$html = $convertcharset->Convert($html, 'utf-8', 'iso-8859-1');
        /*
        
        $fp = @fopen($temphtml,"w");
        if (!$fp)
        	die("Can't open $temphtml");
        fputs($fp, $html);
        @fclose($fp);
        */
        $dompdf = new DOMPDF();
        $dompdf->load_html($html);
        $dompdf->render();
        $dompdf->stream(ProgramTitle() . ".pdf", array("Attachment" => 0));
        //header("Location:dompdf/dompdf.php?input_file=tmp/sis.htm&output_file=sample.pdf");
    } else {
        $html = ob_get_contents();
        ob_end_clean();
        $html = '<HTML><BODY>' . $html . '</BODY></HTML>';
        echo $html;
    }
}
 public static function from_html($html, $title)
 {
     // give us soem breathing room
     ini_set('max_execution_time', 180);
     //$ohtml = $html;
     // pre-parse remote or url based assets
     try {
         $html = self::_pre_parse_remote_assets($html);
     } catch (Exception $e) {
         die('error');
         echo '<h1>Problem parsing html.</h1>';
         echo '<h2>' . force_balance_tags($e->getMessage()) . '</h2>';
         return;
     }
     // if we are debugging the pdf, then depending on the mode, dump the html contents onw
     if (QSOT_DEBUG_PDF & 2) {
         // || ( current_user_can( 'edit_posts' ) && isset( $_GET['as'] ) && 'html' == $_GET['as'] ) ) {
         echo '<pre>';
         echo htmlspecialchars($html);
         echo '</pre>';
         die;
     }
     // include the library
     require_once QSOT::plugin_dir() . 'libs/dompdf/dompdf_config.inc.php';
     // make and output the pdf
     $pdf = new DOMPDF();
     $pdf->load_html($html);
     $pdf->render();
     $pdf->stream(sanitize_title_with_dashes('ticket-' . $title) . '.pdf', array('Attachment' => 1));
     exit;
 }
Beispiel #11
0
 function print_ledger()
 {
     $daterange1 = $this->input->post('daterange1');
     $daterange2 = $this->input->post('daterange2');
     $account_id = $this->input->post('account_id');
     if (empty($daterange1)) {
         redirect('pdf/ledger_date');
     } else {
         $daterange1 = date("Y-m-d", strtotime($daterange1));
         $daterange2 = date("Y-m-d", strtotime($daterange2));
         $data['user_name'] = $this->authex->get_user_name();
         $user_info = $this->authex->get_userdata();
         $data['level'] = $user_info->level;
         $this->load->model('mod_report');
         $data['records'] = $this->mod_report->ledger($daterange1, $daterange2, $account_id);
         $this->load->model('mod_report');
         $info = $this->mod_report->ledger_begining_bal($daterange1, $daterange2, $account_id);
         $data['op_balance'] = $info['op_balance'];
         $data['account_name'] = $info['account_name'];
         $data['daterange1'] = date("d-m-Y", strtotime($daterange1));
         $data['daterange2'] = date("d-m-Y", strtotime($daterange2));
         include_once 'dompdf/dompdf_config.inc.php';
         $html = $this->load->view('print/print_ledger', $data, true);
         $dompdf = new DOMPDF();
         $base_path = $_SERVER['DOCUMENT_ROOT'];
         $dompdf->load_html($html);
         $file_name = "Ledger_" . $info['account_name'];
         $dompdf->render();
         $dompdf->stream("{$file_name}.pdf", array("Attachment" => 0));
     }
 }
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 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);
     }
 }
Beispiel #14
0
 public static function creapdf($url, $tam = "letter", $orient = "portrait")
 {
     //		file_put_contents("fila.txt", "");
     $html = file_get_contents($url);
     if (get_magic_quotes_gpc()) {
         $html = stripslashes($html);
     }
     $ini = strpos($html, '<form');
     $fin = strpos($html, '">', $ini);
     if ($ini > 0) {
         $html = substr_replace($html, "", $ini, $fin - $ini + 2);
         $html = str_replace("</form>", "", $html);
     }
     //		file_put_contents("fila.txt", $html . "\r\n", FILE_APPEND);
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->set_paper($tam, $orient);
     $dompdf->render();
     $dompdf->view = "FitH";
     $dompdf->statusbar = 0;
     $dompdf->messages = 0;
     $dompdf->navpanes = 0;
     $dompdf->stream("sample.pdf", array("Attachment" => false));
     exit(0);
 }
Beispiel #15
0
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));
    }
}
Beispiel #16
0
function pdf_create($html, $filename = '')
{
    require_once "dompdf/dompdf_config.inc.php";
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    $dompdf->stream($filename, array("Attachment" => false));
}
Beispiel #17
0
 public static function render($file, $html)
 {
     static::configure();
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->render();
     $dompdf->stream("{$file}.pdf");
 }
Beispiel #18
0
function pdf_create($html, $filename)
{
    require_once "dompdf/dompdf_config.inc.php";
    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    $dompdf->stream($filename . ".pdf");
}
Beispiel #19
0
 function html2pdf($html, $nombre = 'formato.pdf')
 {
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->set_paper($this->paper, $this->orien);
     $dompdf->render();
     $dompdf->stream($nombre, array('Attachment' => false));
 }
Beispiel #20
0
function pdf_create($html, $filename, $paper, $orientation, $stream = TRUE)
{
    $dompdf = new DOMPDF();
    $dompdf->set_paper($paper, $orientation);
    $dompdf->load_html($html);
    $dompdf->render();
    $dompdf->stream($filename);
}
Beispiel #21
0
function pdf($data, $type, $number)
{
    $title = $type . ' ' . $number;
    $pdf = new DOMPDF();
    $pdf->load_html($data);
    $pdf->render();
    $pdf->stream($title . '.pdf');
}
Beispiel #22
0
 public function generate($html, $filename)
 {
     define('DOMPDF_ENABLE_AUTOLOAD', false);
     require_once "./vendor/dompdf/dompdf/dompdf_config.inc.php";
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->render();
     $dompdf->stream($filename . '.pdf', array("Attachment" => 0));
 }
Beispiel #23
0
 public function fromHtml($resource, array $options = [])
 {
     $resource = parent::getRealResource($resource, $options);
     DompdfNsWrapper::init();
     $dompdf = new \DOMPDF();
     $dompdf->load_html($resource);
     $dompdf->render();
     $dompdf->stream("sample.pdf");
 }
Beispiel #24
0
 function Init($html)
 {
     require 'pdf/dompdfp.php';
     $dompdf = new DOMPDF();
     $dompdf->load_html($html);
     $dompdf->set_paper('letter', 'landscape');
     $dompdf->render();
     $dompdf->stream("report.pdf");
 }
 private function buildPdf()
 {
     require_once APP_PATH . "/../vendor/dompdf/dompdf/dompdf_config.inc.php";
     $dompdf = new \DOMPDF();
     $html = file_get_contents(APP_PATH . '/../Public/apidocs/index.html');
     $dompdf->load_html($html, 'UTF-8');
     $dompdf->render();
     $dompdf->stream("index.pdf");
 }
Beispiel #26
0
 public function genpdf($nro_fact = '', $fecha_factura = '', $nombre = '', $cedula = '', $imei = '', $marca = '', $modelo = '', $desc = '', $total = '')
 {
     require_once "../app/res/dompdf/dompdf_config.inc.php";
     require_once "../app/res/templates/factura.php";
     $dompdf = new DOMPDF();
     $dompdf->load_html($factura);
     $dompdf->render();
     $dompdf->stream("factura-" . $fecha_factura . "-" . $cedula . ".pdf");
 }
 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());
     }
 }
Beispiel #28
0
 /**
  * @param WritableInterface $writable
  * @return void
  */
 public function render(WritableInterface $writable)
 {
     $writable->accept($this->initializer);
     $documentName = $writable->getTitle() === true ? $writable->getTitle() : "document";
     $content = $writable->accept($this->writer);
     $dompdf = new DOMPDF();
     $dompdf->load_html($content);
     $dompdf->render();
     $dompdf->stream($documentName . ".pdf");
 }
Beispiel #29
-4
Datei: Pdf.php Projekt: 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
     }
 }
Beispiel #30
-8
 /**
  * {@inheritdoc}
  */
 public function show($options = ['compress' => 1, 'Attachment' => 0])
 {
     $this->render();
     $this->clear();
     $filename = !is_null($this->filename) ? $this->filename : static::DOWNLOAD_FILENAME;
     return $this->dompdfInstance->stream($filename, $options);
 }