/** * createPdf * Get instance of TransformModel, get HTML from manuscript, pass to conversion tools and send Pdf to browser * @param $options array output options and manuscript src */ public function createPdf(TransformModel $transform, array $options) { $pdf = $this->dfcTools['pdfConverter']; if (!$options['customOptions']['html']) { //if no html has been passed, transform the Word Document $html = '<?xml encoding="UTF-8">' . $transform->getDocumentHTML($options['src']); } else { $html = $options['customOptions']['html']; } $pdf->WriteHTML($html); $pdf->Output(); }
/** * createMobi * Get instance of TransformModel, get HTML from manuscript, pass to conversion tools and send Mobi to browser * @param $options array output options and manuscript src */ public function createMobi(TransformModel $transform, array $options) { $mobi = $this->dfcTools['mobiConverter']; if (!$options['customOptions']['html']) { //if no html has been passed, transform the Word Document $html = $transform->getDocumentHTML($options['src']); } else { $html = $options['customOptions']['html']; } $mobi->setData($html); $zipData = $mobi->download("Example.mobi"); }
/** * createPdf * Get instance of TransformModel, get HTML from manuscript, pass to conversion tools and send Pdf to browser * @param $options array output options and manuscript src */ public function createPdf(TransformModel $transform, array $options) { $pdf = $this->dfcTools['pdfConverter']; if (!$options['customOptions']['html']) { //if no html has been passed, transform the Word Document $html = '<?xml encoding="UTF-8">' . $transform->getDocumentHTML($options['src']); $html = preg_replace('/\\<body[^>]*\\>/', '<body><img src="' . realpath(__DIR__) . '/../../config/book-cover.jpg"/><pagebreak />', $html); } else { $html = $options['customOptions']['html']; } $pdf->WriteHTML($html); $pdf->Output(); }
/** * createMobi * Get instance of TransformModel, get HTML from manuscript, pass to conversion tools and send Mobi to browser * @param $options array output options and manuscript src */ public function createMobi(TransformModel $transform, array $options) { $mobi = $this->dfcTools['mobiConverter']; if (!$options['customOptions']['html']) { //if no html has been passed, transform the Word Document $html = $transform->getDocumentHTML($options['src']); $html = preg_replace('/\\<body[^>]*\\>/', '<body><img src="' . realpath(__DIR__) . '/../../config/book-cover.jpg"/><pagebreak/>', $html); } else { $html = $options['customOptions']['html']; } $mobi->setData($html); $zipData = $mobi->download("Example.mobi"); }
/** * createEpub * Get instance of TransformModel, get HTML from manuscript, pass to conversion tools and send Epub to browser * @param $options array output options and manuscript src */ public function createEpub(TransformModel $transform, array $options) { $epub = $this->dfcTools['epubConverter']; if (!$options['customOptions']['html']) { //if no html has been passed, transform the Word Document $html = strip_tags($transform->getDocumentHTML($options['src']), "<p><script><style><span>"); //an example of basic 'content cleansing' } else { $html = $options['customOptions']['html']; } $epub->setTitle($options['options']['Title']); //setting specific options to the EPub library $epub->setIdentifier($options['options']['Identifier'], EPub::IDENTIFIER_URI); $epub->addChapter("Body", "Body.html", $html); $epub->finalize(); $zipData = $epub->sendBook("Example"); }
/** * createEpub * Get instance of TransformModel, get HTML from manuscript, pass to conversion tools and send Epub to browser * @param $options array output options and manuscript src */ public function createEpub(TransformModel $transform, array $options) { $epub = $this->dfcTools['epubConverter']; if (!$options['customOptions']['html']) { //if no html has been passed, transform the Word Document $html = strip_tags($transform->getDocumentHTML($options['src']), "<p><script><style><span><body>"); //an example of basic 'content cleansing' $html = '<html>' . $html . '</html>'; $html = preg_replace('/\\<script[^\\<]*\\<\\/script\\>/m', '', $html); $html = preg_replace('/\\<style[^\\<]*\\<\\/style\\>/m', '', $html); $html = str_replace(' ', ' ', $html); } else { $html = $options['customOptions']['html']; } $epub->setCoverImage("config/book-cover.jpg"); $epub->setTitle($options['options']['Title']); //setting specific options to the EPub library $epub->setIdentifier($options['options']['Identifier'], EPub::IDENTIFIER_URI); $epub->addChapter("Body", "Body.html", $html); $epub->finalize(); $zipData = $epub->sendBook("Example"); }