本文整理汇总了PHP中HTML2PDF::writeHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML2PDF::writeHTML方法的具体用法?PHP HTML2PDF::writeHTML怎么用?PHP HTML2PDF::writeHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML2PDF
的用法示例。
在下文中一共展示了HTML2PDF::writeHTML方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
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');
}
示例2: voucher
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;
}
}
示例3: smarty_function_article_pdf
/**
* 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;
}
示例4: rappel
function rappel($buffer)
{
$date = date('Ymd-hi');
$html2pdf = new HTML2PDF('P', 'LETTER', 'fr');
$html2pdf->writeHTML($buffer);
$html2pdf->Output($date . '_valeur_inventaire.pdf', 'D');
}
示例5: Core
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');
}
示例6: convert
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');
}
示例7:
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");
}
示例8: generarPDF
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;
}
示例9: index
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;
}
}
示例10: convert
/**
* @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;
}
示例11: test
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');
}
示例12: streamPdfFile
/**
* 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;
}
}
示例13: Core
function laporan_pdf($PMBPeriodID)
{
$this->load->library('HTML2PDF');
$html2pdf = new HTML2PDF('L', 'A4', 'fr');
$html2pdf->setDefaultFont('Arial');
//filter
#get filter
$fil['PMBPeriodID'] = $PMBPeriodID;
//$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_lap_peserta->get_pdf($fil);
/* if (count($da['row'])==0){
echo "Data Tidak Tersedia";
return;
} */
$konten = $this->load->view('pmb/peserta_laporan', $data, true);
$html2pdf->writeHTML($konten, false);
$html2pdf->Output('peserta_pmb.pdf');
}
示例14: cetak
public function cetak()
{
$date = new DateTime('now', new DateTimeZone('Asia/Jakarta'));
$today = $date->format('d-m-Y');
$this->load->model('crud_model');
$data['data'] = $this->crud_model->reportUsers();
ob_start();
$content = $this->load->view('reportUser', $data);
$content = ob_get_clean();
$filename = "Lap_user" . $today . ".pdf";
//nama file pdf
$this->load->library('html2pdf');
try {
$html2pdf = new HTML2PDF('P', 'A4', 'en', false, 'ISO-8859-15', array(20, 10, 10, 10));
//$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->setDefaultFont('Arial');
$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
$html2pdf->Output($filename);
} catch (HTML2PDF_exception $e) {
echo $e;
exit;
}
}
示例15: createPdf
public function createPdf()
{
$salesPersonId = JFactory::getSession()->get('salesPersonId');
//$filter = JRequest::getVar('filter', array('name' => "", 'code' => "", 'merchant_id' => "", 'fromdate' => "", 'todate' => ""));
//$filter = JRequest::getVar('filter',array(),'post','array');
$currency_prefix = JModel::getInstance('setting', 'enmasseModel')->getCurrencyPrefix();
$dealList = JModel::getInstance('deal', 'enmasseModel')->searchBySaleReports($salesPersonId, JRequest::getVar('name'), JRequest::getVar('merchant_id'), JRequest::getVar('fromdate'), JRequest::getVar('todate'), JRequest::getVar('code'));
if (empty($dealList)) {
return null;
}
$result = '<table style="border:1px dotted #D5D5D5; border-collapse: collapse;"><tr valign="middle"><th style="border:1px dotted #D5D5D5;" align="center" width="50">' . JText::_("No") . '</th><th style="border:1px dotted #D5D5D5;" width="150">' . JText::_("Deal Code") . '</th><th style="border:1px dotted #D5D5D5;" width="150">' . JText::_("Deal Name") . '</th><th style="border:1px dotted #D5D5D5;" width="100">' . JText::_("Merchant") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Qty Sold") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Unit Price") . '</th><th style="border:1px dotted #D5D5D5;" align="center" width="80">' . JText::_("Total Sales") . '</th></tr>';
$i = 0;
foreach ($dealList as $row) {
$i++;
$merchant_name = JModel::getInstance('merchant', 'enmasseModel')->retrieveName($row->merchant_id);
$total_sales = $row->price * $row->cur_sold_qty;
$result .= '<tr>
<td style="border:1px dotted #D5D5D5;" align="center">' . $i . '</td>
<td style="border:1px dotted #D5D5D5;">' . $row->deal_code . '</td>
<td style="border:1px dotted #D5D5D5;">' . $row->name . '</td>
<td style="border:1px dotted #D5D5D5;">' . $merchant_name . '</td>
<td style="border:1px dotted #D5D5D5;" align="center">' . $row->cur_sold_qty . '</td>
<td style="border:1px dotted #D5D5D5;" align="center">' . $currency_prefix . $row->price . '</td>
<td style="border:1px dotted #D5D5D5;" align="center">' . $currency_prefix . $total_sales . '</td></tr>';
$total_amount += $total_sales;
}
$result .= '<tr><td style="border:1px dotted #D5D5D5;" colspan="6" style="text-align:right" >Total Amount: </td>
<td style="border:1px dotted #D5D5D5;" align="center">' . $currency_prefix . $total_amount . '</td></tr></table>';
//todo
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_enmasse' . DS . 'helpers' . DS . 'html2pdf' . DS . 'html2pdf.class.php';
$html2pdf = new HTML2PDF('P', 'A4', 'en');
$html2pdf->setDefaultFont('Arial');
$html2pdf->writeHTML($result);
$outFileName = 'report-' . DatetimeWrapper::getDateOfNow() . '.pdf';
$html2pdf->Output($outFileName, 'I');
die;
}