本文整理汇总了PHP中mPDF::mPDF方法的典型用法代码示例。如果您正苦于以下问题:PHP mPDF::mPDF方法的具体用法?PHP mPDF::mPDF怎么用?PHP mPDF::mPDF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mPDF
的用法示例。
在下文中一共展示了mPDF::mPDF方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* PDFresource constructor
*
* @param modX $modx A reference to the modX instance.
* @param array $options An array of options. Optional.
*/
function __construct(modX &$modx, array $options = array())
{
$this->modx =& $modx;
$corePath = $this->getOption('core_path', $options, $this->modx->getOption('core_path') . 'components/' . $this->namespace . '/');
$assetsPath = $this->getOption('assets_path', $options, $this->modx->getOption('assets_path') . 'components/' . $this->namespace . '/');
$assetsUrl = $this->getOption('assets_url', $options, $this->modx->getOption('assets_url') . 'components/' . $this->namespace . '/');
$pdfPath = $this->getOption('pdf_path', $options, $this->modx->getOption('assets_path') . 'pdf/');
$pdfUrl = $this->getOption('pdf_url', $options, $this->modx->getOption('assets_url') . 'pdf/');
// Load some default paths for easier management
$this->options = array_merge(array('namespace' => $this->namespace, 'version' => $this->version, 'assetsPath' => $assetsPath, 'assetsUrl' => $assetsUrl, 'cssUrl' => $assetsUrl . 'css/', 'jsUrl' => $assetsUrl . 'js/', 'imagesUrl' => $assetsUrl . 'images/', 'corePath' => $corePath, 'modelPath' => $corePath . 'model/', 'vendorPath' => $corePath . 'vendor/', 'chunksPath' => $corePath . 'elements/chunks/', 'pagesPath' => $corePath . 'elements/pages/', 'snippetsPath' => $corePath . 'elements/snippets/', 'pluginsPath' => $corePath . 'elements/plugins/', 'controllersPath' => $corePath . 'controllers/', 'processorsPath' => $corePath . 'processors/', 'templatesPath' => $corePath . 'templates/', 'connectorUrl' => $assetsUrl . 'connector.php', 'pdfPath' => $pdfPath, 'pdfUrl' => $pdfUrl), $options);
// Init mPDF options
$mode = $this->modx->getOption('mode', $options, '');
$format = $this->modx->getOption('format', $options, 'A4');
$default_font_size = intval($this->modx->getOption('defaultFontSize', $options, 0));
$default_font = $this->modx->getOption('defaultFont', $options, '');
$mgl = intval($this->modx->getOption('mgl', $options, 15));
$mgr = intval($this->modx->getOption('mgr', $options, 15));
$mgt = intval($this->modx->getOption('mgt', $options, 16));
$mgb = intval($this->modx->getOption('mgb', $options, 16));
$mgh = intval($this->modx->getOption('mgb', $options, 9));
$mgf = intval($this->modx->getOption('mgf', $options, 9));
$orientation = $this->modx->getOption('orientation', $options, 'P');
parent::mPDF($mode, $format, $default_font_size, $default_font, $mgl, $mgr, $mgt, $mgb, $mgh, $mgf, $orientation);
$customFonts = $this->modx->fromJSON($this->modx->getOption('customFonts', $options, ''));
if (is_array($customFonts)) {
foreach ($customFonts as $f => $fs) {
$this->fontdata[$f] = $fs;
if (isset($fs['R']) && $fs['R']) {
$this->available_unifonts[] = $f;
}
if (isset($fs['B']) && $fs['B']) {
$this->available_unifonts[] = $f . 'B';
}
if (isset($fs['I']) && $fs['I']) {
$this->available_unifonts[] = $f . 'I';
}
if (isset($fs['BI']) && $fs['BI']) {
$this->available_unifonts[] = $f . 'BI';
}
}
} else {
$this->modx->log(modX::LOG_LEVEL_ERROR, 'customFonts does not contain an array.', '', 'PDFresource');
}
$this->default_available_fonts = $this->available_unifonts;
}
示例2: mPDF
function __construct($mode = '', $format = 'A4', $default_font_size = 0, $default_font = '', $mgl = 15, $mgr = 15, $mgt = 16, $mgb = 16, $mgh = 9, $mgf = 9, $orientation = 'P')
{
parent::mPDF();
#$mpdf=new mPDF($mode,$format,$default_font_size,$default_font,$mgl,$mgr,$mgt,$mgb,$mgh,$mgf,$orientation);
}