本文整理汇总了PHP中mPDF::SetDisplayMode方法的典型用法代码示例。如果您正苦于以下问题:PHP mPDF::SetDisplayMode方法的具体用法?PHP mPDF::SetDisplayMode怎么用?PHP mPDF::SetDisplayMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mPDF
的用法示例。
在下文中一共展示了mPDF::SetDisplayMode方法的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: printRelatorioHTMLPDF
private function printRelatorioHTMLPDF($html)
{
$this->getContext()->getConfiguration()->loadHelpers('Partial');
$mpdf = new mPDF('', 'A4', '', '', 5, 5, 37, 37, 3, 3);
$mpdf->useOnlyCoreFonts = true;
// false is default
$mpdf->SetWatermarkText("PÉROLA NEGRA");
$mpdf->showWatermarkText = true;
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->watermarkTextAlpha = 0.1;
$mpdf->SetDisplayMode('fullpage');
$stylesheet = file_get_contents('css/relatorios.css');
$mpdf->WriteHTML($stylesheet, 1);
$mpdf->SetHTMLHeader(utf8_encode(get_partial('header')));
$mpdf->SetHTMLFooter(utf8_encode(get_partial('footer')));
$mpdf->SetMargins(0, 0, 65);
$mpdf->WriteHTML(utf8_encode($html));
$mpdf->Output();
}
示例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: basicMPdfConfiguration
protected function basicMPdfConfiguration(\mPDF $mPDF)
{
$mPDF->biDirectional = false;
$mPDF->useSubstitutions = false;
$mPDF->simpleTables = true;
$mPDF->SetAuthor($this->documentAuthor);
$mPDF->SetDisplayMode('default', 'continuous');
}
示例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: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->bind('mpdf.wrapper', function ($app, $cfg) {
$app['mpdf.pdf'] = $app->share(function ($app) use($cfg) {
if (!empty($cfg)) {
foreach ($cfg as $key => $value) {
Config::set('pdf.' . $key, $value);
}
}
$mpdf = new \mPDF(Config::get('pdf.mode'), Config::get('pdf.defaultFontSize'), Config::get('pdf.defaultFont'), Config::get('pdf.marginLeft'), Config::get('pdf.marginRight'), Config::get('pdf.marginTop'), Config::get('pdf.marginBottom'), Config::get('pdf.marginHeader'), Config::get('pdf.Footer'), Config::get('pdf.orientation'));
$permissions = [];
foreach (Config::get('pdf.protection.permissions') as $perm => $enable) {
if ($enable) {
$permissions[] = $perm;
}
}
$mpdf->SetProtection($permissions, Config::get('pdf.protection.user_password'), Config::get('pdf.protection.owner_password'), Config::get('pdf.protection.length'));
$mpdf->SetTitle(Config::get('pdf.title'));
$mpdf->SetAuthor(Config::get('pdf.author'));
$mpdf->SetWatermarkText(Config::get('pdf.watermark'));
$mpdf->showWatermarkText = Config::get('pdf.showWatermark');
$mpdf->watermark_font = Config::get('pdf.watermarkFont');
$mpdf->watermarkTextAlpha = Config::get('pdf.watermarkTextAlpha');
$mpdf->SetDisplayMode(Config::get('pdf.displayMode'));
return $mpdf;
});
return new PdfWrapper($app['mpdf.pdf']);
});
}
示例7: 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;
}
示例8: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->bind('mpdf.wrapper', function ($app, $cfg) {
if ($cfg) {
$app['mpdf.pdf'] = $app->share(function ($app) use($cfg) {
$mpdf = new \mPDF($cfg[0], $cfg[1], $cfg[2], $cfg[3], $cfg[4], $cfg[5], $cfg[6], $cfg[7], $cfg[8], $cfg[9], $cfg[10]);
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle("");
$mpdf->SetAuthor("");
$mpdf->SetWatermarkText("");
$mpdf->showWatermarkText = true;
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->watermarkTextAlpha = 0.1;
$mpdf->SetDisplayMode('fullpage');
return $mpdf;
});
} else {
$mpdf = new \mPDF('th', 'A4', '', '', 10, 10, 10, 10, 10, 5);
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle("");
$mpdf->SetAuthor("");
$mpdf->SetWatermarkText("");
$mpdf->showWatermarkText = true;
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->watermarkTextAlpha = 0.1;
$mpdf->SetDisplayMode('fullpage');
$app['mpdf.pdf'] = $mpdf;
}
return new PdfWrapper($app['mpdf.pdf']);
});
// // work --------------------------------------------------------------------------start ----------
// $this->app['mpdf.pdf'] = $this->app->share(function($app)
// {
// // $cfg =['th','A0','','',10,10,10,10,10,5,'L'];
// $cfg = $app['config']['mpdfconfig.pdf.options'];
// consolelog('cfg',$cfg);
// if($cfg) {
// $mpdf = new \mPDF( $cfg[0],$cfg[1],$cfg[2],$cfg[3],$cfg[4],$cfg[5],$cfg[6],$cfg[7],$cfg[8],$cfg[9],$cfg[10] );
// } else {
// $mpdf=new \mPDF('th','A4','','',10,10,10,10,10,5);
// }
// $mpdf->SetProtection(array('print'));
// $mpdf->SetTitle("TOMATO POS - Invoice");
// $mpdf->SetAuthor("Thongchai Lim");
// $mpdf->SetWatermarkText("Paid");
// $mpdf->showWatermarkText = true;
// $mpdf->watermark_font = 'DejaVuSansCondensed';
// $mpdf->watermarkTextAlpha = 0.1;
// $mpdf->SetDisplayMode('fullpage');
// return $mpdf;
// });
// $this->app['mpdf.wrapper'] = $this->app->share(function($app)
// {
// return new PdfWrapper($app['mpdf.pdf']);
// });
// // work --------------------------------------------------------------------------end----------
}
示例9: index
public function index()
{
$mpdf = new mPDF('UTF-8', 'A3', '', 'demo', 0, 0);
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0;
// 1 or 0 - whether to indent the first level of a list
$mpdf->useAdobeCJK = true;
$mpdf->autoScriptToLang = true;
$mpdf->autoLangToFont = true;
$mpdf->useAdobeCJK = true;
$html = $this->getUrlInfo('http://edusystem.onpspring.org/AdminList/studentsTranscript/userid/238.html');
var_dump($html);
exit;
$mpdf->WriteHTML($html);
$mpdf->SetDisplayMode('fullpage');
$mpdf->Output('mpdf.pdf', 'I');
exit;
}
示例10: createMpdfInstance
/**
* @param array $options Options for mPDF.
* @return \mPDF
*/
protected function createMpdfInstance($options)
{
$tempDir = sys_get_temp_dir() . '/mpdf';
is_dir($tempDir) or mkdir($tempDir);
defined('_MPDF_TEMP_PATH') or define('_MPDF_TEMP_PATH', $tempDir);
$mpdf = new \mPDF(isset($options['lang']) ? $options['lang'] : static::DEFAULT_LANGUAGE, isset($options['format']) ? $options['format'] : static::DEFAULT_PAGE_FORMAT, isset($options['fontSize']) ? $options['fontSize'] : static::DEFAULT_FONT_SIZE, isset($options['font']) ? $options['font'] : static::DEFAULT_FONT, isset($options['marginLeft']) ? $options['marginLeft'] : static::DEFAULT_MARGIN, isset($options['marginRight']) ? $options['marginRight'] : static::DEFAULT_MARGIN, isset($options['marginTop']) ? $options['marginTop'] : static::DEFAULT_MARGIN, isset($options['marginBottom']) ? $options['marginBottom'] : static::DEFAULT_MARGIN, isset($options['marginHeader']) ? $options['marginHeader'] : static::DEFAULT_MARGIN, isset($options['marginFooter']) ? $options['marginFooter'] : static::DEFAULT_MARGIN, isset($options['orientation']) ? $options['orientation'] : static::DEFAULT_ORIENTATION);
$mpdf->SetDisplayMode('fullpage', 'two');
$mpdf->SetProtection(['copy', 'print', 'print-highres'], null, uniqid(), 128);
return $mpdf;
}
示例11: _gen_pdf
public function _gen_pdf($html, $paper, $layoutpage)
{
ob_end_clean();
$mpdf = new mPDF('utf-8', $paper);
ini_set('memory_limit', '100M');
$mpdf->debug = true;
$mpdf->SetDisplayMode('fullpage');
$mpdf->AddPage($layoutpage);
$mpdf->WriteHTML($html);
$mpdf->Output();
}
示例12: send
public function send()
{
$this->loadData();
$mpdf = new mPDF('utf-8', 'A4');
$mpdf->useOnlyCoreFonts = true;
$mpdf->SetDisplayMode('fullpage');
$mpdf->SetAutoFont(0);
// CSS soubory
$css[] = './styles/faktura.css';
// faktura v HTML (PHP, atd.)
$html[] = KIWI_INVOICE . '?bauth&o=' . $this->id;
foreach ($css as $filename) {
@$mpdf->WriteHTML(file_get_contents($filename, true), 1);
}
foreach ($html as $filename) {
@$mpdf->WriteHTML(file_get_contents($this->file2Url($filename)), 2);
}
$o_id = sprintf("%03d", $this->data->YID) . "-{$this->data->Year}";
$name = "invoice_{$o_id}.pdf";
$mpdf->Output($name, "D");
// download
}
示例13: generate
/**
* Generates the invoice with MPDF lib.
* @param $dest
* @return string
*/
protected function generate($html_sections, $dest, $paid)
{
set_time_limit(0);
$mpdf_filename = BEWPI_LIB_DIR . 'mpdf/mpdf.php';
include $mpdf_filename;
$mpdf_options = $this->get_mpdf_options();
$mpdf = new mPDF($mpdf_options['mode'], $mpdf_options['format'], $mpdf_options['default_font_size'], $mpdf_options['default_font'], $mpdf_options['margin_left'], $mpdf_options['margin_right'], $mpdf_options['margin_top'], $mpdf_options['margin_bottom'], $mpdf_options['margin_header'], $mpdf_options['margin_footer'], $mpdf_options['orientation']);
$mpdf->useOnlyCoreFonts = false;
// false is default
if ((bool) $this->template_options['bewpi_show_payment_status'] && $paid) {
$mpdf->SetWatermarkText(__('Paid', 'woocommerce-pdf-invoices'));
$mpdf->showWatermarkText = true;
}
$mpdf->SetDisplayMode('fullpage');
//$mpdf->useSubstitutions = true;
$mpdf->autoScriptToLang = true;
$mpdf->autoLangToFont = true;
$mpdf->setAutoTopMargin = 'stretch';
$mpdf->setAutoBottomMargin = 'stretch';
$mpdf->autoMarginPadding = 10;
//$mpdf->debug = true;
//$mpdf->showImageErrors = true;
if (!empty($html_sections['header'])) {
$mpdf->SetHTMLHeader($html_sections['header']);
}
if (!empty($html_sections['footer'])) {
$mpdf->SetHTMLFooter($html_sections['footer']);
}
$mpdf->WriteHTML($html_sections['style'] . $html_sections['body']);
$mpdf = apply_filters('bewpi_mpdf', $mpdf);
$mpdf->Output($dest === 'F' ? $this->full_path : $this->filename, $dest);
}
示例14: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
// load config
$this->mergeConfigFrom(__DIR__ . '/../../config/pdf.php', 'pdf');
// bind wrapper
$this->app->bind('mpdf.wrapper', function ($app, $cfg) {
$app['mpdf.pdf'] = $app->share(function ($app) use($cfg) {
if (!empty($cfg)) {
foreach ($cfg as $key => $value) {
Config::set('pdf.' . $key, $value);
}
}
$mpdf = new \mPDF(Config::get('pdf.mode'), Config::get('pdf.format'), Config::get('pdf.defaultFontSize'), Config::get('pdf.defaultFont'), Config::get('pdf.marginLeft'), Config::get('pdf.marginRight'), Config::get('pdf.marginTop'), Config::get('pdf.marginBottom'), Config::get('pdf.marginHeader'), Config::get('pdf.marginFooter'), Config::get('pdf.orientation'));
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle(Config::get('pdf.title'));
$mpdf->SetAuthor(Config::get('pdf.author'));
$mpdf->SetWatermarkText(Config::get('pdf.watermark'));
$mpdf->showWatermarkText = Config::get('pdf.showWatermark');
$mpdf->watermark_font = Config::get('pdf.watermarkFont');
$mpdf->watermarkTextAlpha = Config::get('pdf.watermarkTextAlpha');
$mpdf->SetDisplayMode(Config::get('pdf.displayMode'));
return $mpdf;
});
return new PdfWrapper($app['mpdf.pdf']);
});
}
示例15: generate
/**
* Erzeugt ein PDF auf Basis der übergebenen Funktion.
* @param $module
* @param $action
* @param $param
* @param null $filename falls kein Dateiname angegeben wird, wird das PDF direkt im Browser ausgegeben
* @throws \Exception
*/
public static function generate($module, $action, $param, $filename = null, $template = true, $margin = 0)
{
$druckinhalt = new WrapperControl(null, 'druck');
$druckinhalt->setModule($module)->setAction($action)->addParams($param);
$pdf = new \mPDF('de-DE', 'A4');
$pdf->SetDisplayMode('fullpage');
// Zeigt eine ganze Seite an, wenn das PDF in Acrobat geöffnet wird
if ($margin > 0) {
$pdf->SetTopMargin($margin);
}
$pdf->SetFooter('Seite {PAGENO} / {nb}');
//file_get_contents('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css') .
$stylesheet = file_get_contents('templates/print/css/default.css');
$pdf->WriteHTML($stylesheet, 1);
if ($template && file_exists('site/Print.template.html')) {
$vars = ['heading' => Application::getCurrentResponse()->getMetadata()->getHeading()];
$header = Parser::parse(null, null, $vars, file_get_contents('site/Print.template.html'));
$pdf->WriteHTML($header, 2);
}
$pdf->WriteHTML($druckinhalt->toHtml(), 2);
if ($filename === null) {
$pdf->Output($module . $action . '.pdf', 'I');
} else {
//$filename = Files::validateFilename($filename);
$pdf->Output($filename, 'F');
}
unset($pdf);
}