本文整理汇总了PHP中mPDF::WriteHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP mPDF::WriteHTML方法的具体用法?PHP mPDF::WriteHTML怎么用?PHP mPDF::WriteHTML使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mPDF
的用法示例。
在下文中一共展示了mPDF::WriteHTML方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadMpdf
function loadMpdf($html, $output = null, $param = 1)
{
// echo "masuk";
// echo $output;
// exit;
global $CONFIG;
$pdf_ext = '.pdf';
$mpdfEngine = '../' . LIBS . 'mpdf/mpdf' . $CONFIG[$this->configkey]['php_ext'];
if (is_file($mpdfEngine)) {
require_once $mpdfEngine;
if ($param == 1) {
$mpdf = new mPDF('c', 'A4', '', '', 15, 15, 16, 16, 9, 9, 'L');
$mpdf->SetDisplayMode('fullpage');
} elseif ($param == 2) {
$mpdf = new mPDF('', '', '', '', 15, 15, 16, 16, 9, 9, 'P');
$mpdf->AddPage('L', '', '', '', '', 15, 15, 16, 16, 9, 9);
}
// $mpdf=new mPDF('c','A4','','',32,25,27,25,16,13);
// $mpdf->setFooter('{PAGENO}') ;
$mpdf->WriteHTML($html);
$mpdf->Output($output . '-' . date(ymdhis) . $pdf_ext, 'D');
logFile('load excel success');
} else {
logFile('excel lib not found');
}
exit;
}
示例2: Staff_Detail_pdf
public function Staff_Detail_pdf(){
$timeZoneFormat=$this->Mdl_eilib_common_function->getTimezone();
$this->load->library('pdf');
$pdfresult='';
$STDTL_SEARCH_cpfnumber=$_GET['STDTL_SEARCH_cpfnumber'];
$STDTL_SEARCH_staffexpense_selectquery=$_GET['STDTL_SEARCH_staffexpense_selectquery'];
$STDTL_SEARCH_cpffrom_form=$_GET['STDTL_SEARCH_cpffrom_form'];
$STDTL_SEARCH_cpfto_form=$_GET['STDTL_SEARCH_cpfto_form'];
$STDTL_SEARCH_staffcommentstxt=$_GET['STDTL_SEARCH_staffcommentstxt'];
$emp_first_name=$_GET['emp_first_name'];
$emp_last_name=$_GET['emp_last_name'];
$pdfresult = $this->Mdl_staff_detail_entry_search_update_delete->Staff_Detail_pdf($STDTL_SEARCH_staffexpense_selectquery,$STDTL_SEARCH_cpfnumber,$STDTL_SEARCH_cpffrom_form,$STDTL_SEARCH_cpfto_form,$STDTL_SEARCH_staffcommentstxt,$emp_first_name,$emp_last_name);//$timeZoneFormat,$_GET['EMPSRC_UPD_DEL_lb_designation_listbox'],$_GET['emp_first_name'],$_GET['emp_last_name'],$_GET['EMPSRC_UPD_DEL_ta_mobile'],$_GET['EMPSRC_UPD_DEL_lb_employeename_listbox'],$_GET['EMPSRC_UPD_DEL_lb_searchoption'],$_GET['EMPSRC_UPD_DEL_ta_email'],$_GET['EMPSRC_UPD_DEL_ta_comments']);
$header=$_GET['header'];
$header= str_replace("^","&",$header);
$pdfheader=$header;//'TICKLER HISTORY FOR CUSTOMER:'.$TH_fname.' '.$TH_lname;
$pdf = $this->pdf->load();
$pdf=new mPDF('utf-8','A4-L');
$pdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">'.$pdfheader.'</div>', 'O', true);
$pdf->SetHTMLFooter('<div style="text-align: center;">{PAGENO}</div>');
$pdf->WriteHTML($pdfresult);
$pdf->Output($pdfheader.'.pdf', 'D');
$data=$this->Mdl_staff_daily_entry_search_update_delete->Staff_Daily_pdf();
echo json_encode($data);
}
示例3: downloadpdfAction
/**
* PDF of a test order is downloaded by this method
*/
public function downloadpdfAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$id = $this->getRequest()->getParam('id', '');
$email = $this->getRequest()->getParam('email', 0);
require_once 'mpdf/mpdf.php';
$html .= $this->view->action('viewreport', 'patient', 'patient', array('id' => $id));
$mpdf = new mPDF('+aCJK', 'A4', '', '', 15, 15, 15, 0, 0, 0);
$mpdf->mirrorMargins = 0;
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->SetDisplayMode('fullwidth');
$mpdf->WriteHTML($html);
$fileName = 'PDF_Form' . time() . '.pdf';
$mpdf->Output('tmp/' . $fileName, $email ? 'F' : 'D');
if ($email) {
$patient = patient::getOrderById($id);
$mail = new PHPMailer();
$mail->From = 'kashif.ir@gmail.com';
$mail->FromName = 'Lab';
$mail->addAddress($patient[0]['email'], '');
$mail->addAttachment('tmp/' . $fileName);
$mail->Subject = 'Your Test Report';
$mail->Body = 'Please find attached report';
if (!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
unlink('tmp/' . $fileName);
$flashMessenger = $this->_helper->getHelper('FlashMessenger');
$flashMessenger->addMessage('mail_sent');
$this->_redirect('/patient/orders');
}
}
}
示例4: exportBill
/**
* @param array $info_warranty
* @param array $info_car
* @param array $info_bill
* @param array $info_ss
* @param $denpyoNo
* @param null $savetype
* @param null $watermark
* @return bool|string
* @throws \Exception
*/
public function exportBill($info_warranty = [], $info_car = [], $info_bill = [], $info_ss = [], $denpyoNo = null, $savetype = null, $watermark = null)
{
$data = ['info_warranty' => $info_warranty, 'info_car' => $info_car, 'info_bill' => $info_bill, 'info_ss' => $info_ss];
$stringTarget = Pdfbill::widget($data);
$pdf = new \mPDF('ja', 'A4', 0, 'DejaVuSansCondensed', '4', '4', '5', '5', '4', '4');
$pdf->WriteHTML($stringTarget);
if ($watermark) {
$pdf->SetWatermarkImage('../web/img/confidentiality.png', 0.6);
$pdf->showWatermarkImage = true;
}
utilities::createFolder('data/pdf');
//Create folder data/pdf
if ($savetype == 'save') {
if (file_exists('data/pdf/' . $denpyoNo . '.pdf')) {
return false;
}
$pdf->Output('data/pdf/' . $denpyoNo . '.pdf', 'F');
if (file_exists('data/pdf/' . $denpyoNo . '.pdf')) {
return true;
}
} else {
utilities::createFolder('data/tmp');
$name = 'draft-' . md5(uniqid(mt_rand(), true)) . '.pdf';
$filename = "data/tmp/{$name}";
$pdf->Output($filename, 'F');
return $filename;
}
}
示例5: loadMpdf
function loadMpdf($html, $output = null, $path = null)
{
// echo "masuk";
// echo $output;
// exit;
global $CONFIG;
$hslpath = $path . "hasil/";
$pdf_ext = '.pdf';
$mpdfEngine = LIBS . 'mpdf/mpdf' . $CONFIG[$this->configkey]['php_ext'];
if (is_file($mpdfEngine)) {
require_once $mpdfEngine;
$mpdf = new mPDF('c', 'A4', '', '', 32, 25, 27, 25, 16, 13);
$mpdf->SetDisplayMode('fullpage');
/*$mpdf=new mPDF('','','','',15,15,16,16,9,9,'P');
$mpdf->AddPage('L','','','','',15,15,16,16,9,9);
$mpdf->setFooter('{PAGENO}') ;*/
$stylesheet = file_get_contents($CONFIG['default']['root_path'] . 'assets/css/mpdfstyleA4.css');
$mpdf->WriteHTML($stylesheet, 1);
$mpdf->WriteHTML($html);
$mpdf->Output($hslpath . $output . $pdf_ext, 'F');
logFile('load excel success');
return true;
} else {
logFile('excel lib not found');
}
exit;
}
示例6: generate
/**
* Converte e exibe um text/html em formato PDF.
*
* @access public
* @param string $html - O html a ser exibido.
* @return void
*/
public function generate($html)
{
require_once BASEPATH . "libraries/mpdf60/mpdf.php";
$mpdf = new mPDF('en-X', 'A4', '', '', 11, 11, 10, 10, 5, 5, 'P');
$mpdf->WriteHTML($html);
$mpdf->Output();
}
示例7: Pdfcreation
public function Pdfcreation()
{
$USERSTAMP = $this->Mdl_eilib_common_function->getSessionUserStamp();
$this->load->library('pdf');
$pdfresult = '';
$custname = $this->input->get('custname');
$custid = $this->input->get('custnameid');
$unitno = $this->input->get('unitno');
$cardno = $this->input->get('cardno');
$option = $this->input->get('option');
$pdfresult = $this->Mdl_access_card_view->Pdf_creation($custid, $unitno, $cardno, $option, $USERSTAMP);
$pdfheader = '';
if ($option == 18) {
$pdfheader = 'ACCESS CARD DETAIL FOR CARD NO ' . $cardno;
} else {
if ($option == 21) {
$pdfheader = 'ACCESS CARD DETAIL FOR CUSTOMER ' . $custname;
} else {
if ($option == 31) {
$pdfheader = 'ACCESS CARD DETAILS FOR THE UNIT NUMBER ' . $unitno;
} else {
if ($option == 40) {
$pdfheader = 'ACCESS CARD DETAILS FOR ALL UNITS';
}
}
}
}
$pdf = $this->pdf->load();
$pdf = new mPDF('utf-8', 'A4');
$pdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">' . $pdfheader . '</div>', 'O', true);
$pdf->SetHTMLFooter('<div style="text-align: center;">{PAGENO}</div>');
$pdf->WriteHTML($pdfresult);
$pdf->Output($pdfheader . '.pdf', 'D');
}
示例8: renderPdf
/**
* Tworzenie pdf na podstawie html
*
* @param type $rendered
* @param type $dest typ wyjścia zgdny z biblioteka MPDF
* @param type $name nazwa/ sciezka do pliku (jesli $dest jest F)
*/
public static function renderPdf($rendered, $dest = 'D', $name = 'reklamacja.pdf')
{
require_once APPLICATION_PATH . '/../library/Mpdf/mpdf.php';
$mpdf = new mPDF('utf-8', 'A4', '', '', '15', '15', '16', '30', '9', '20');
$mpdf->WriteHTML($rendered);
$mpdf->Output($name, $dest);
}
示例9: renderPdf
protected function renderPdf($html, $filename, $options)
{
$this->_helper->viewRenderer->setNoRender();
$margin_left = isset($options['margins']['left']) ? $options['margins']['left'] : 15;
$margin_right = isset($options['margins']['right']) ? $options['margins']['right'] : 15;
$margin_top = isset($options['margins']['top']) ? $options['margins']['top'] : 15;
$margin_bottom = isset($options['margins']['bottom']) ? $options['margins']['bottom'] : 15;
$margin_header = isset($options['margins']['header']) ? $options['margins']['header'] : 15;
$margin_footer = isset($options['margins']['footer']) ? $options['margins']['footer'] : 15;
$format = isset($options['format']) ? $options['format'] : 'A4-L';
$output_mode = isset($options['output']) ? $options['output'] : 'D';
define('_MPDF_URI', APPLICATION_PATH . '/../library/MPDF54/');
define('_MPDF_TEMP_PATH', '/var/www/tm/');
require_once APPLICATION_PATH . "/../library/MPDF54/mpdf.php";
/* argumentos:
* mode: codificacao (basicamente)
* format: formato da pagina (pode ser adicionado -L depois do formato para forcar modo paisagem
* tamanho da fonte: e passado 0 para que o tamanho seja setado no arquivo CSS
* fonte
* margin_left
* margin_right
* margin_top
* margin_bottom
* margin_header
* margin_footer
*/
$mpdf = new mPDF('utf-8', $format, 0, '', $margin_left, $margin_right, $margin_top, $margin_bottom, $margin_header, $margin_footer);
$mpdf->ignore_invalid_utf8 = true;
$mpdf->charset_in = 'utf-8';
$mpdf->SetDisplayMode('fullpage', 'two');
$mpdf->WriteHTML($mpdf->purify_utf8($html));
$mpdf->Output($filename . '.pdf', $output_mode);
exit;
}
示例10: pdf
function pdf($html, $filename = null)
{
require_once "mpdf/mpdf.php";
$mpdf = new mPDF();
//$mpdf->allow_charset_conversion=true;
//$mpdf->charset_in='iso-8859-1';
//Exibir a pagina inteira no browser
//$mpdf->SetDisplayMode('fullpage');
//Cabeçalho: Seta a data/hora completa de quando o PDF foi gerado + um texto no lado direito
//$mpdf->SetHeader('{DATE j/m/Y H:i}|{PAGENO}/{nb}|Texto no cabeçalho');
//Rodapé: Seta a data/hora completa de quando o PDF foi gerado + um texto no lado direito
//$mpdf->SetFooter('{DATE j/m/Y H:i}|{PAGENO}/{nb}|Texto no rodapé');
$mpdf->WriteHTML($html);
// define um nome para o arquivo PDF
if ($filename == null) {
$filename = date("Y-m-d_his") . '_impressao.pdf';
}
$path = APPPATH . 'relatorios/';
var_dump($path);
if (is_dir($path)) {
$mpdf->Output($path . $filename, 'F');
redirect('relatorio_gerado' . $filename);
//base_url("/assets/js/jquery-1.9.1.js");
} else {
echo 'error';
}
// $mpdf->Output($filename, 'F');
//I: send the file inline to the browser. The plug-in is used if available. The name given by filename is used when one selects the "Save as" option on the link generating the PDF.
//D: send to the browser and force a file download with the name given by filename.
//F: save to a local file with the name given by filename (may include a path).
//S: return the document as a string. filename is ignored.
}
示例11: pdf
public function pdf($content, $namafile, $paper_size = '', $orientation = 'P', $border = true, $title = '', $subject = '', $mode = 'D', $watermark = false)
{
$margin = 20;
$namafile = preg_replace('/\\.pdf$/', '', $namafile);
$mL = $mR = $mT = $mB = $margin;
// $mB = $margin + 50;
$mH = 0;
$mF = 0;
if (!$paper_size) {
$paper_size = array(215, 330);
}
Yii::import('system.docotel.cms.extensions.mpdf.mPDF');
$mpdf = new mPDF('', $paper_size, 0, '', $mL, $mR, $mT, $mB, $mH, $mF, $orientation);
$mpdf->SetDefaultFont('Arial');
$mpdf->SetProtection(array('print', 'print-highres'), '', md5(time()), 128);
$mpdf->SetTitle($title);
$mpdf->SetAuthor('Makarim & Taira');
$mpdf->SetCreator('News');
$mpdf->SetSubject($subject);
$mpdf->h2toc = array('H4' => 0, 'H5' => 1);
//$mpdf->setFooter('{PAGENO}');
// $stylesheet = file_get_contents(Yii::app()->getBaseUrl(true).'/themes/flatlab/assets/css/bootstrap.min.css'); // external css
// $mpdf->WriteHTML($stylesheet,1);
// echo $content; exit;
$mpdf->WriteHTML($content);
$mpdf->Output($namafile . '.pdf', $mode);
if ($mode === 'D' or $mode === 'I') {
exit;
}
}
示例12: savePdf
public function savePdf($content, $filename)
{
$previousErrorReporting = error_reporting(0);
$pdf = new \mPDF('', $this->format);
$pdf->WriteHTML($content);
$pdf->Output($filename, 'f');
error_reporting($previousErrorReporting);
}
示例13: MPDF
protected static function MPDF($html, $fileout)
{
self::loadLib('/mpdf/mpdf.php');
$html2pdf = new mPDF('c', 'A4');
//('P', 'A4', 'en');
$html2pdf->WriteHTML($html);
$html2pdf->Output($fileout, 'F');
}
示例14: create_pdf
public function create_pdf($name, $size, $html)
{
ob_end_clean();
$mpdf = new mPDF('utf-8', $size);
$mpdf->WriteHTML(utf8_encode($html));
$mpdf->Output($name . ".pdf", 'I');
exit;
}
示例15: savePdf
/**
* @param \App\Model\Pdf\IPdfTemplate $pdfTemplate
* @param $filename
*
* @return string
*/
public function savePdf(IPdfTemplate $pdfTemplate, $filename)
{
$filename = rtrim($this->documentStorage, "/") . "/" . $filename;
$html = (string) $pdfTemplate->render();
$mpdf = new \mPDF();
$mpdf->WriteHTML($html);
$mpdf->Output($filename, "F");
return $filename;
}