2 namespace Utility\Export;
10 * Filename to use for output
13 protected $_fileName = null;
19 * @param \Utility\Service\PdfTemplate $template
21 public function __construct(\Utility\Service\PdfTemplate $template)
23 $this->_fileName = str_replace(' ', '-', $template->getTitle()) . '.pdf';
24 $this->_htmlData = $template->getHtml();
29 * @todo add email, filesystem and ftp as potential targets.
30 * @param null|string $target
32 public function output($target = null)
36 $html2pdf = new \HTML2PDF('P', 'A4', 'en', true, 'UTF-8', array(5, 5, 5, 5));
37 $html2pdf->writeHTML($this->_htmlData);
41 $html2pdf->Output($this->_fileName, 'D');
44 elseif (strpos($target, '@'))
48 elseif (empty($target))
51 return $html2pdf->Output($this->_fileName, 'S');
56 $html2pdf->Output($target . $this->_fileName, 'F');