Я пытаюсь экспортировать в PDF с использованием MPDF.Сгенерированный pdf показывает только данные массива.
Это для localhost, работающего на сервере xampp.Версия PHP 7.1.26, Apache / 2.4.38 (Win64)
(new CWidget())
->setTitle(_('Services'))
->setWebLayoutMode($page['web_layout_mode'])
->setControls(new CList([
(new CForm('get'))
->cleanItems()
->setAttribute('aria-label', _('Main filter'))
->addItem((new CList())
->addItem([
new CLabel(_('Period'), 'period'),
(new CDiv())->addClass(ZBX_STYLE_FORM_INPUT_MARGIN),
$period_combo
])
),
(new CTag('nav', true, get_icon('fullscreen')))->setAttribute('aria-label', _('Content controls'))
]))
->addItem(BR())
->addItem($tree->getHTML())
->show();
require_once _DIR_ .'/../../vendor/autoload.php';
ob_clean();
$mpdf = new \Mpdf\Mpdf(['debug' => true,'allow_output_buffering' => true]);
$stylesheet = file_get_contents($page['web_layout_mode']);
$mpdf->WriteHTML($stylesheet,\Mpdf\HTMLParserMode::DEFAULT_MODE);
$arr=$tree->getHTML();
$html='<div>'.json_encode($arr).'</div>';
$mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
$mpdf->Output();
}
OUTPUT:
The generated pdf contains these codes:
{"items":["\u003Cscript src=\"js\/class.ctree.js\"
type=\"text\/javascript\"\u003E\u003C\/script\u003E\n\u003Cscript type=\"text\/javascript\"\u003E
var service_status_tree_tree = {};service_status_tree_tree['0'] = { status: 'close', nodelist :
The actual result should be exact copy of the webpage info.