'P', 'unit' => 'mm', 'format' => 'LETTER', 'unicode' => true, 'encoding' => 'UTF-8', 'diskcache' => false, 'pdfa' => false, ); public function __construct(array $config = null) { $this->_initTCPDF($config); return $this; } protected function _initTCPDF($config) { $tcpdfConfig = require_once WWW_PATH . '/_lib/qs-config/pdfRendererTcPdf.php'; require_once BASE_PATH . '/lib/tcpdf/tcpdf.php'; if (!is_dir(K_PATH_CACHE) && !mkdir(K_PATH_CACHE, 0777, true)) { throw new Exception('Can not create ' . __CLASS__ . ' cache folder "' . K_PATH_CACHE . '"'); } $config = array_merge($tcpdfConfig, $config); foreach ($this->_defaults as $name => $value) { if (!isset($config[$name])) { $config[$name] = $value; } } $this->_tcpdf = new TCPDF( $config['orientation'], $config['unit'], $config['format'], $config['unicode'], $config['encoding'], $config['diskcache'], $config['pdfa'] ); if (isset($config['imageScaleRatio'])) { $this->_tcpdf->setImageScale((float) $config['imageScaleRatio']); } $this->_tcpdf->addPage(); return $this; } public function setHtml($html) { $this->_tcpdf->writeHTML($html); return $this; } public function save($filename) { $this->_tcpdf->Output($filename, self::MODE_FILE); return $this; } public function inline($filename) { $this->_tcpdf->Output($filename, self::MODE_INLINE); return $this; } public function download($filename) { $this->_tcpdf->Output($filename, self::MODE_DOWNLOAD); return $this; } public function render() { return $this->_tcpdf->Output(null, self::MODE_STRING); } /** * @return \TCPDF */ public function getRenderer() { return $this->_tcpdf; } }