public function imprimirOrdenCompra($detalle, $anexos, $system, $id_orden){ require_once(APP_PATH . 'common/plugins/sigma/demos/export_php/html2pdf/html2pdf.class.php'); template()->buildFromTemplates('report/orden_compra.html'); page()->setTitle('Orden de compra'); page()->addEstigma("detalle", array('SQL', $detalle)); page()->addEstigma("anexos", array('SQL', $anexos)); page()->addEstigma("norden", $id_orden); page()->addEstigma("nombre_empresa", $system->nombre_comercial); page()->addEstigma("direccion_empresa", $system->direccion); @template()->parseOutput(); @template()->parseExtras(); $html2pdf = new HTML2PDF('L', 'lette', 'es'); $html2pdf->WriteHTML(page()->getContent()); $html2pdf->Output('ticket.pdf'); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function getIndex($order_id) { $id = $order_id; $invoicedata = Invoice::where('Id', $id)->get(); $html22 = View('viewinvoice')->with(array('invoicedata' => $invoicedata))->render(); require_once app_path() . '/libs/html2pdf/html2pdf.class.php'; $html2pdf = new \HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0)); // $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->WriteHTML($html22); $html2pdf->Output('Invoice.pdf'); }
public function generer($html, $nom_fichier = '', $dest = 'I', $sens = self::SENS, $format = self::FORMAT, $margin = array(self::MARGIN, self::MARGIN, self::MARGIN, self::MARGIN)) { try { $html2pdf = new HTML2PDF($sens, $format, self::LANG, self::UNICODE, self::ENCODING, $margin); $html2pdf->pdf->SetDisplayMode('real'); $html2pdf->writeHTML($html); $html2pdf->Output($nom_fichier, $dest); } catch (Exception $e) { die("Echec de création du document PDF: {$e}"); } }
public function cetak() { ob_start(); $data['siswa'] = $this->siswa_model->view(); $this->load->view('print', $data); $html = ob_get_contents(); ob_end_clean(); require_once './assets/html2pdf/html2pdf.class.php'; $pdf = new HTML2PDF('P', 'A4', 'en'); $pdf->WriteHTML($html); $pdf->Output('TOEFL_Exam_Report.pdf', 'D'); }
protected static function HTML2PDF($html, $fileout) { self::loadLib('/html2pdf/html2pdf.class.php'); $html2pdf = new HTML2PDF('P', 'A4', 'en'); $html2pdf->WriteHTML($html); return $html2pdf->Output($fileout, 'F'); }
function html2pdf($html, $nombre = "archivo.pdf", $orientacion = "P", $tamanio = "A4", $tituloDocumento = '') { $colegioSessionBean = new ColegioSessionBean(); $fechaActual = obtenerFechaActualFull(); $html = str_replace("\\", "", $html); ob_start(); //include(dirname(__FILE__).'/res/exemple07a.php'); //include(dirname(__FILE__).'/res/exemple07b.php'); echo '<link rel="stylesheet" href="' . PATH_HTTP . 'css/tablas.css" type="text/css" />'; //$html = ereg_replace("\\", "XD", $html); echo '<table> <tr> <td align="center" width="1200"><strong>' . $colegioSessionBean->getNombre() . '</strong> <br/>' . $tituloDocumento . '</td> <td rowspan="2"><img alt="logo" title="logo" src="' . PATH_HTTP . 'images/' . $colegioSessionBean->getColegio_ID() . '/logo.jpg"></td> </tr> </table> <div style="width:1200px; align=right;font-size:8px;">Informe generado el ' . $fechaActual . '</div><br/>'; echo $html; $content = ob_get_clean(); // conversion HTML => PDF //require_once(dirname(__FILE__).'/../html2pdf.class.php'); $html2pdf = new HTML2PDF($orientacion, $tamanio, 'es'); $html2pdf->pdf->SetDisplayMode('fullpage'); //$html2pdf->pdf-> // $html2pdf->pdf->SetProtection(array('print'), 'spipu'); $html2pdf->WriteHTML($content, isset($_GET['vuehtml'])); //echo $content; $html2pdf->Output($nombre); }
function laporan_pdf($kd_fakultas, $kd_prodi, $tahun, $nim) { $this->load->library('HTML2PDF'); $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->setDefaultFont('Arial'); //filter #get filter $fil['kd_fakultas'] = $kd_fakultas; $fil['kd_prodi'] = $kd_prodi; $fil['tahun'] = $tahun; $fil['nim'] = $nim; //$data['nama'] = ''; $data['namaUniv'] = 'STMIK BANDUNG'; $data['alamatUniv'] = 'Jl.Phh.Mustofa No. 39. Grand Surapati Core (SUCORE) Blok M No.19, Telp.022 - 7207777'; $data['kotaUniv'] = 'Bandung, Jawa Barat'; // ambil data dari tabel $data['data_pdf'] = $this->mdl_khs->get_pdf($fil, $nama_dosen); /* if (count($da['row'])==0){ echo "Data Tidak Tersedia"; return; } */ $konten = $this->load->view('perkuliahan/khs_laporan', $data, true); $html2pdf->writeHTML($konten, false); $html2pdf->Output('khs.pdf'); }
function rappel($buffer) { $date = date('Ymd-hi'); $html2pdf = new HTML2PDF('P', 'LETTER', 'fr'); $html2pdf->writeHTML($buffer); $html2pdf->Output($date . '_valeur_inventaire.pdf', 'D'); }
function laporan_pdf($kode) { $data['kd_mahasiswa'] = $kode; $this->load->library('HTML2PDF'); $html2pdf = new HTML2PDF('L', 'Letter', 'fr'); $html2pdf->setDefaultFont('Arial'); //filter #get filter /* $fil['kd_fakultas'] = $kd_fakultas; $fil['kd_prodi'] = $kd_prodi; $fil['tahun'] = $tahun; $fil['nim'] = $nim; */ //$data['nama'] = 'indriyanto'; $data['namaUniv'] = 'UNIVERSITAS SUBANG'; $data['alamatUniv'] = 'Jln. Perkutut Kotaraja, Telp.(0967)581562'; $data['kotaUniv'] = 'Subang, Jawa Barat'; // ambil data dari tabel $data['data_pdf'] = $this->mdl_ijazah->get_pdf($kode); /* if (count($da['row'])==0){ echo "Data Tidak Tersedia"; return; } */ $konten = $this->load->view('ta/ijazah_format', $data, true); $html2pdf->writeHTML($konten, false); $html2pdf->Output('exemple00.pdf'); }
public function postApproveinvoice(Request $request) { $approve_id = Input::get('invoice_approve_id'); $post = Input::get(); $i = Invoice::where('Id', $approve_id)->update(array('Status' => $post['approve_status'])); $invoicedata = Invoice::where('Id', $approve_id)->get(); foreach ($invoicedata as $inv) { $email = $inv->ClientEmail; $invno = $inv->InvoiceCode; $clientmail = $inv->ClientName; } if ($i > 0) { $html22 = View('pdfgenerate')->with(array('invoicedata' => $invoicedata))->render(); $html1 = "<h1>adsfadsfasdf</h1>"; require_once app_path() . '/libs/html2pdf/html2pdf.class.php'; $html2pdf = new \HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0)); // $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->WriteHTML($html22); $htmltosend = $html2pdf->Output('', 'S'); $a = 'IDE | Proforma invoice_'; $subject = $a . $invno . $clientmail; Mail::send('emails.invoice', ['Invoice' => 'hgff'], function ($message) use($subject, $htmltosend, $email) { // note: if you don't set this, it will use the defaults from config/mail.php $message->from('*****@*****.**', 'IDE Consulting Services Pvt Ltd'); $message->to($email)->subject($subject)->attachData($htmltosend, 'invoice.pdf', array('mime' => 'application/pdf', 'Content-Disposition' => 'attachment')); }); $request->session()->flash('alert-success', 'Invoice has been set to client !'); return redirect('home2'); } }
public function voucher($numFile = false) { if (!$numFile) { $this->redireccionar('booking'); } //Session::acceso('Usuario'); $numFile = base64_decode($numFile); $numFile = $numFile * 1; $ruta_img = 'views/layout/' . DEFAULT_LAYOUT . '/img/'; $ruta_img2 = 'public/img/voucher/'; ob_start(); require_once ROOT . 'views' . DS . 'system' . DS . 'pdf' . DS . 'vouchea.php'; $content = ob_get_clean(); $this->getLibrary('html2pdf.class'); try { $html2pdf = new HTML2PDF('P', 'A4', 'es', false, CHARSET); //$html2pdf->setModeDebug(); $html2pdf->setDefaultFont('Arial'); $html2pdf->writeHTML($content, isset($_GET['vuehtml'])); $html2pdf->Output('Voucher_N_' . $numFile . '.pdf'); } catch (HTML2PDF_exception $e) { echo $e; exit; } }
public function convertHtmlToFormat($orientation = 'P') { require_once 'html2pdf/html2pdf.class.php'; $html2pdf = new HTML2PDF($orientation, 'A4', 'fr'); $html2pdf->setDefaultFont('times'); $html2pdf->WriteHTML($this->docTemplate->render()); $this->doc = $html2pdf->Output(NULL, 'S'); }
/** * @throws HTML2PDF_exception */ public function html2pdf() { $content = "\n\t\t<page>\n\t\t <h1>Exemple d'utilisation</h1>\n\t\t <br>\n\t\t Ceci est un <b>exemple d'utilisation</b>\n\t\t de <a href='http://html2pdf.fr/'>HTML2PDF</a>.<br>\n\t\t</page>"; //require_once(dirname(__FILE__).'/html2pdf/html2pdf.class.php'); $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->WriteHTML(file_get_contents($this->load->view('htmlpdf'))); $html2pdf->Output('exemple.pdf'); }
public function convert($data) { $width = 8.5 * 25.4; $height = 11 * 25.4; $html = new HTML2PDF('P', array($width, $height), 'en'); $html->writeHTML($data); // header('Cache-Control: private, max-age=0, must-revalidate'); $html->Output('resume.pdf'); }
/** * Recieve the html and generate the pdf * @param string $html */ function setOrderPdf($html, $fileName) { ob_end_clean(); $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(mL, mT, mR, mB)); //$html2pdf->addFont("times"); $html2pdf->WriteHTML($html); $html2pdf->Output($fileName . '.pdf'); die; }
function laporan_pdf($date_1, $date_2) { $this->load->library('HTML2PDF'); $html2pdf = new HTML2PDF('P', 'A4', 'fr'); $html2pdf->setDefaultFont('Arial'); $data['data_pdf'] = $this->mdl_report_delivery->report_delivery_pdf($date_1, $date_2); $konten = $this->load->view('report_delivery/delivery_report', $data, true); $html2pdf->writeHTML($konten, false); $html2pdf->Output("Report_delivery_" . $date_1 . " To " . $date_2 . ".pdf"); }
public function cetak() { $npm = $this->session->userdata('npm'); ob_start(); $data['nilai'] = $this->Model_nilai->getNilai($npm); $this->load->view('member/nilai/print', $data); $html = ob_get_contents(); ob_get_clean(); require_once './assets/html2pdf/html2pdf.class.php'; $pdf = new HTML2PDF('P', 'A4', 'en'); $pdf->WriteHTML($html); $pdf->Output('Data Nilai.pdf', 'R'); }
private function generarPDF($vista, $data, $orientacion) { require_once app_path('/ayudantes/report/html2pdf.class.php'); $pdf = new \HTML2PDF($orientacion, 'letter', 'es'); $pdf->pdf->SetDisplayMode('fullpage'); try { $html = \View::make($vista, $data)->render(); $pdf->writeHTML($html); $pdf->Output($vista . '.pdf'); } catch (\HTML2PDF_exception $e) { die($e . " :("); } die; }
public function index() { $this->load->model('model_data'); $data['data'] = $this->model_data->tampil(); ob_start(); $content = $this->load->view('data', $data); $content = ob_get_clean(); $this->load->library('html2pdf'); try { $html2pdf = new HTML2PDF('L', 'A4', 'fr'); $html2pdf->pdf->SetDisplayMode('fullpage'); $html2pdf->writeHTML($content, isset($_GET['vuehtml'])); $html2pdf->Output('print.pdf'); } catch (HTML2PDF_exception $e) { echo $e; exit; } }
/** * @return self */ public function convert($filePathIn, $filePathOut, $formats = ['html', 'pdf']) { $output = ['html' => '', 'pdf' => '']; $replace = ['content' => '', 'js' => '', 'css' => '']; try { $tpl = TemplatesRegistry::get($this->usedTemplate); foreach (['js', 'css'] as $type) { foreach ($tpl[$type] as $file) { if (!is_readable($file)) { throw new \Exception("Cannot load file {$file}."); } $file = file_get_contents($file); $replace[$type] .= $file . "\n"; } } if (file_exists("{$filePathOut}.html")) { unlink("{$filePathOut}.html"); } $replace['content'] = $this->mdParser->parse(file_get_contents($filePathIn)); $output['html'] = $this->latte->renderToString($tpl['layout'], $replace); $this->fs->write("{$filePathOut}.html", $output['html']); if (in_array('pdf', $formats)) { try { $html2pdf = new \HTML2PDF('P', 'A4', 'cs'); $html2pdf->setDefaultFont('dejavusans'); //$html2pdf->addFont('dejavusans'); $html2pdf->pdf->SetDisplayMode('real'); $output['html'] = str_replace('\\xe28087', "  ", $output['html']); $html2pdf->writeHTML($output['html']); $pdf = $html2pdf->Output("{$filePathOut}.pdf", 'S'); $this->fs->write("{$filePathOut}.pdf", $pdf); } catch (Html2PdfException $e) { $formatter = new ExceptionFormatter($e); echo "PDF: " . $formatter->getHtmlMessage(); } } if (!in_array('html', $formats)) { //unlink("{$filePathOut}.html"); } } catch (\InvalidArgumentException $e) { echo $e->getMessage(), "\n"; } return $this; }
function test() { $item_id = $_GET['id']; if (isset($_GET['show_answers'])) { $show_answers = $_GET['show_answers']; } else { $show_answers = 2; } $test = new Test(); $test->createFromItem($item_id); $test->questions = $test->getAllQuestions(); $content = ''; $content .= '<h2>List of questions for ' . $test->title . ' course</h2>'; $questions = $test->questions; if (count($questions)) { $content .= '<ol>'; for ($i = 0; $i < count($questions); $i++) { $content .= '<li>' . $questions[$i]->question . '<br/>'; if ($show_answers) { foreach ($questions[$i]->answers as $answer) { if ($show_answers == '2') { if ($answer['is_right'] == 'yes') { $content .= '☑ '; } else { $content .= '☐ '; } } else { $content .= '☐ '; } $content .= $answer['answer'] . '<br/>'; } } $content .= '</li>'; } $content .= '</ol>'; } $content = '<page style="font-family: freeserif"><br />' . $content . '</page>'; $html2pdf = new HTML2PDF('P', 'A4', 'fr'); //$html2pdf->pdf->SetDisplayMode('real'); $html2pdf->writeHTML($content); $html2pdf->Output('utf8.pdf'); }
/** * Html to pdf and stream HTML2PDF * * @param $html * @param $name */ public function streamPdfFile($html, $name) { // include html2pdf library require_once Mage::getBaseDir('lib') . '/html2pdf/html2pdf.class.php'; // debug pdf html if (true == Mage::getStoreConfig('catalogexport/pdf/html_debug')) { echo $this->_prepare($html); die; } try { $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', 0); // display the full page //$html2pdf->pdf->SetDisplayMode('fullpage'); //$html2pdf->createIndex('Sommaire', 25, 12, false, false); $html2pdf->writeHTML($this->_prepare($html)); $html2pdf->Output($name . '.pdf'); exit; } catch (HTML2PDF_exception $e) { echo $e; exit; } }
/** * Newscoop article_pdf function plugin * * Type: function * Name: article_pdf * Purpose: * * @param array * $params[template] * $params[prefix] * @param object * $smarty The Smarty object */ function smarty_function_article_pdf($params, &$smarty) { // gets the context variable $gimme = $smarty->getTemplateVars('gimme'); if (isset($params['template'])) { $template = $params['template']; } $pdf_filename = ''; if (isset($params['prefix'])) { $pdf_filename = $params['prefix'] . '-'; } $publish = new DateTime($gimme->article->publish_date); $pdf_filename .= 'p' . $publish->format('Ymd') . '-n' . $gimme->article->number . '.pdf'; $pdf_file = 'public/pdf/' . $pdf_filename; if (!file_exists($pdf_file) || $gimme->article->last_update > date('Y-m-d h:i:s', filemtime($pdf_file))) { require 'include/html2pdf/html2pdf.class.php'; try { $content = $smarty->fetch($template); $html2pdf = new HTML2PDF('P', 'A4', 'de'); $html2pdf->pdf->SetDisplayMode('real'); $html2pdf->writeHTML($content); $html2pdf->Output($pdf_file, 'F'); } catch (HTML2PDF_exception $e) { return ''; } } return $pdf_file; }
function convert2pdf($content, $file_name) { if ($file_name == '') { $file_name = date('y_m_d_h_m_s') . '.pdf'; } require_once dirname(__FILE__) . '/html2pdf.class.php'; // get the HTML //ob_start(); //include(dirname(__FILE__).'/about_1.php'); //$content = ob_get_clean(); try { // init HTML2PDF $html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(0, 0, 0, 0)); $html2pdf->setDefaultFont('dejavusans'); //add this line // display the full page $html2pdf->pdf->SetDisplayMode('fullpage'); // convert $html2pdf->writeHTML($content, isset($_GET['vuehtml'])); // add the automatic index //$html2pdf->createIndex('Sommaire', 30, 12, false, true, 2); // send the PDF $html2pdf->Output($file_name); } catch (HTML2PDF_exception $e) { echo $e; exit; } }
public static function write($content, $dir) { try { $html2pdf = new HTML2PDF('P', 'A4', 'es'); $html2pdf->writeHTML($content); $html2pdf->Output($dir, 'F'); return true; } catch (Exception $ex) { print_r($ex); return false; } }
function laporan_pdf_kode($kode_barang) { $this->load->library('HTML2PDF'); $html2pdf = new HTML2PDF('L', 'A4', 'fr'); $html2pdf->setDefaultFont('Arial'); $data['data_pdf'] = $this->mdl_report_buy->report_buy_pdf_kode($kode_barang); $konten = $this->load->view('report_buy/buy_report_kode', $data, true); $html2pdf->writeHTML($konten, false); $html2pdf->Output("Report_buy" . $kode_barang . ".pdf"); }
public function save($file) { $pdfs = array(); foreach ($this->_html as $i => $page) { $f = '/tmp/' . Athem_Utils::randString(10); $pdf = new HTML2PDF($this->_getOrientation(), $this->_getSize(), 'en'); $pdf->WriteHTML($page); $pdf->Output("{$f}.pdf", 'F'); $pdfs[] = "{$f}.pdf"; } $pdfMerge = Athem_Pdf_Merge_Abstract::factory($this->_page['merge'], $pdfs); $pdfMerge->save($file); }
public function render($file = NULL) { $html = parent::render($file); $html2pdf = new HTML2PDF('P', 'A4', $this->_langue); $html2pdf->pdf->SetAuthor($this->_author); $html2pdf->pdf->SetTitle($this->_title); $html2pdf->pdf->SetSubject($this->_subject); $html2pdf->pdf->SetKeywords($this->_keywords); $html2pdf->WriteHTML($html); $html2pdf->Output('public/pdf/' . $this->_name, 'F'); }
public function actionPendidikans() { $html2pdf = Yii::app()->ePdf->html2pdf('L', 'A4', 'en', false, 'ISO-8859-15', array(10, 5, 10, 5)); $html2pdf->pdf->SetDisplayMode('fullpage'); $dosen = Yii::app()->request->getParam('id_dosen', 0); $pj = Yii::app()->request->getParam('pengajuan', 0); $sql = "select unsur_pendidikan.ID_UNSUR_PEND,subun_pend.SUBUNPEND,tbl_dosen.NAMA_DOSEN, tbl_dosen.NIP_DOSEN, \n tbl_jabatan.NAMA_JABATAN, tbl_golongan.GOLONGAN, tbl_golongan.PANGKAT, tbl_jurusan.NAMA_JURUSAN, \n tbl_jurusan.NAMA_PIMPINAN, tbl_jurusan.NIP_PIMPINAN, tbl_jurusan.PANGKAT AS PJ, tbl_jurusan.GOLONGAN AS GJ, tbl_fakultas.NAMA_FAKULTAS, \n unsur_pendidikan.KEGIATAN_PENDIDIKAN, unsur_pendidikan.TEMPAT_PENDIDIKAN, \n unsur_pendidikan.TGL_KEGIATAN_PEND, unsur_pendidikan.NILAI_PENDIDIKAN, \n unsur_pendidikan.BUKTI_PENDIDIKAN, unsur_pendidikan.PENGAJUAN_KE \n from unsur_pendidikan inner join subun_pend on \n unsur_pendidikan.ID_SUBUNPEND=subun_pend.ID_SUBUNPEND join tbl_dosen \n on unsur_pendidikan.ID_DOSEN=tbl_dosen.ID_DOSEN join tbl_jabatan on \n tbl_dosen.ID_JABATAN=tbl_jabatan.ID_JABATAN join tbl_golongan on \n tbl_dosen.ID_GOLONGAN=tbl_golongan.ID_GOLONGAN join tbl_jurusan on \n tbl_dosen.ID_JURUSAN=tbl_jurusan.ID_JURUSAN join tbl_fakultas on \n tbl_jurusan.ID_FAKULTAS=tbl_fakultas.ID_FAKULTAS where \n unsur_pendidikan.ID_DOSEN='{$dosen}' and unsur_pendidikan.PENGAJUAN_KE='{$pj}' "; $data = Yii::app()->db->createCommand($sql)->queryAll(); $content = $this->renderPartial('pendidikans', array('data' => $data), true); $html2pdf = new HTML2PDF('L', 'A4', 'en', array(10, 5, 10, 5)); $html2pdf->WriteHTML($content); $html2pdf->Output(); }
public function printInvoice($id) { $data = $this->payment_model->get($id); if (!$data) { echo "Not data"; die; } else { //echo $id; $this->template = new View('admin_invoice/invoice', true); $this->template->set(array('test' => $this->test_model->get($data['test_uid']), 'member' => $this->member_model->get($data['member_uid']), 'mr' => $data)); require Kohana::find_file('vendor/html2pdf', 'html2pdf'); $html2pdf = new HTML2PDF(); //$html2pdf->HTML2PDF('L','A4', 'en', array(10, 10, 10, 10)); $html2pdf->HTML2PDF('P', 'letter', 'en', array(10, 10, 10, 10)); $html2pdf->WriteHTML($this->template, false); echo $html2pdf->Output('Sales_Order_' . $data['uid'] . '.pdf'); } }