Lines Matching +full:font +full:- +full:size +(+path:plugin +path:dw2pdf) -(+path:plugin +path:dw2pdf +path:lang)

46         $this->tpl = $this->getExportConfig('template');
50 * Delete cached files that were for one-time use
54 if ($this->onetimefile) {
55 unlink($this->onetimefile);
64 return $this->currentBookChapter;
74 $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'convert');
75 $controller->register_hook('TEMPLATE_PAGETOOLS_DISPLAY', 'BEFORE', $this, 'addbutton');
76 $controller->register_hook('MENU_ITEMS_ASSEMBLY', 'AFTER', $this, 'addsvgbutton');
91 if (!in_array($event->data, $allowedEvents)) {
97 [$this->title, $this->list] = $this->collectExportablePages($event);
99 if ($event->data === 'export_pdf' && ($REV || $DATE_AT)) {
101 $this->onetimefile = $cachefile;
106 $cache = $this->prepareCache($depends);
107 $cachefile = $cache->cache;
108 $generateNewPdf = !$this->getConf('usecache')
109 || $this->getExportConfig('isDebug')
110 || !$cache->useCache($depends);
118 $this->generatePDF($cachefile, $event);
121 if ($INPUT->has('selection')) {
123 echo $e->getMessage();
127 msg($e->getMessage(), -1);
128 $event->data = 'redirect';
132 $event->preventDefault(); // after prevent, $event->data cannot be changed
135 $this->sendPDFFile($cachefile); //exits
140 * - Return a title and selection, throw otherwise an exception
141 * - Check permisions
156 if ($event->data == 'export_pdf') {
161 $title = $INPUT->str('pdftitle'); //DEPRECATED
162 $title = $INPUT->str('book_title', $title, true);
173 throw new Exception($this->getLang('notexist'));
175 } elseif ($event->data == 'export_pdfns') {
177 if (!$title = $INPUT->str('book_title')) {
178 throw new Exception($this->getLang('needtitle'));
180 $pdfnamespace = cleanID($INPUT->str('book_ns'));
182 throw new Exception($this->getLang('needns'));
186 $order = $INPUT->str('book_order', 'natural', true);
193 $depth = $INPUT->int('book_nsdepth', 0);
205 $excludes = $INPUT->arr('excludes');
212 $excludesns = $INPUT->arr('excludesns');
244 } elseif (!empty($_COOKIE['list-pagelist'])) {
247 $title = $INPUT->str('pdfbook_title'); //DEPRECATED
248 $title = $INPUT->str('book_title', $title, true);
250 throw new Exception($this->getLang('needtitle'));
253 $list = explode("|", $_COOKIE['list-pagelist']);
254 } elseif ($INPUT->has('selection')) {
258 // print $this->getLang('empty');
262 $list = json_decode($INPUT->str('selection', '', true), true);
264 throw new Exception($this->getLang('empty'));
267 $title = $INPUT->str('pdfbook_title'); //DEPRECATED
268 $title = $INPUT->str('book_title', $title, true);
270 throw new Exception($this->getLang('needtitle'));
272 } elseif ($INPUT->has('savedselection')) {
275 throw new Exception($this->getLang('missingbookcreator'));
279 $savedselection = $SelectionHandling->loadSavedSelection($INPUT->str('savedselection'));
281 $title = $INPUT->str('book_title', $title, true);
285 throw new Exception($this->getLang('needtitle'));
289 throw new Exception($this->getLang('empty'));
304 if (!$INPUT->bool('book_skipforbiddenpages') && $skippedpages !== []) {
306 throw new Exception(sprintf($this->getLang('forbidden'), $msg));
322 $cachekey = implode(',', $this->list)
324 . $this->getExportConfig('template')
325 . $this->getExportConfig('pagesize')
326 . $this->getExportConfig('orientation')
327 . $this->getExportConfig('font-size')
328 . $this->getExportConfig('doublesided')
329 . $this->getExportConfig('headernumber')
330 . ($this->getExportConfig('hasToC') ? implode('-', $this->getExportConfig('levels')) : '0')
331 . $this->title;
335 foreach ($this->list as $pageid) {
359 $depends['files'] = array_map('wikiFN', $this->list);
416 if ($event->data == 'export_pdf') { //only one page is exported
426 $hasToC = $this->getExportConfig('hasToC');
427 $levels = $this->getExportConfig('levels');
428 $isDebug = $this->getExportConfig('isDebug');
429 $watermark = $this->getExportConfig('watermark');
435 $this->getExportConfig('pagesize'),
436 $this->getExportConfig('orientation'),
437 $this->getExportConfig('font-size'),
438 $this->getDocumentLanguage($this->list[0]) //use language of first page
447 $mpdf->SetBasePath($url);
450 $mpdf->SetTitle($this->title);
453 //note: double-sided document, starts at an odd page (first page is a right-hand side page)
454 // single-side document has only odd pages
455 $mpdf->mirrorMargins = $this->getExportConfig('doublesided');
456 $mpdf->setAutoTopMargin = 'stretch';
457 $mpdf->setAutoBottomMargin = 'stretch';
458 // $mpdf->pagenumSuffix = '/'; //prefix for {nbpg}
460 $mpdf->h2toc = $levels;
462 $mpdf->PageNumSubstitutions[] = ['from' => 1, 'reset' => 0, 'type' => '1', 'suppress' => 'off'];
466 $mpdf->SetWatermarkText($watermark);
467 $mpdf->showWatermarkText = true;
471 $template = $this->loadTemplate();
480 $styles = '@page { size:auto; ' . $template['page'] . '}';
483 $styles .= '@page landscape-page { size:landscape }';
484 $styles .= 'div.dw2pdf-landscape { page:landscape-page }';
485 $styles .= '@page portrait-page { size:portrait }';
486 $styles .= 'div.dw2pdf-portrait { page:portrait-page }';
487 $styles .= $this->loadCSS();
489 $mpdf->WriteHTML($styles, 1);
503 $mpdf->WriteHTML($body_start, 2, true, false); //start body html
508 //Note: - for double-sided document the ToC is always on an even number of pages, so that the
510 // - first page of ToC starts always at odd page (so eventually an additional blank page
512 // - there is no page numbering at the pages of the ToC
513 $mpdf->TOCpagebreakByArray([
514 'toc-preHTML' => '<h2>' . $this->getLang('tocheader') . '</h2>',
515 'toc-bookmarkText' => $this->getLang('tocheader'),
525 $no_pages = count($this->list);
526 foreach ($this->list as $page) {
527 $this->currentBookChapter = $counter;
530 $pagehtml = $this->wikiToDW2PDF($page, $rev, $date_at);
535 $pagehtml .= $this->pageDependReplacements($template['cite'], $page);
540 $mpdf->WriteHTML($pagehtml, 2, false, false); //intermediate body html
551 $mpdf->WriteHTML($body_end, 2, false); // finish body html
560 if ($INPUT->str('debughtml', 'text', true) == 'text') {
561 header('Content-Type: text/plain; charset=utf-8');
568 $mpdf->Output($cachefile, 'F');
576 header('Content-Type: application/pdf');
577 header('Cache-Control: must-revalidate, no-transform, post-check=0, pre-check=0');
581 $outputTarget = $INPUT->str('outputTarget', $this->getConf('output'));
583 $filename = rawurlencode(cleanID(strtr($this->title, ':/;"', ' ')));
585 header('Content-Disposition: attachment; filename="' . $filename . '.pdf";');
587 header('Content-Disposition: inline; filename="' . $filename . '.pdf";');
591 header('Set-Cookie: fileDownload=true; path=/');
601 echo "Could not read file - bad permissions?";
631 $file = DOKU_PLUGIN . 'dw2pdf/tpl/' . $this->tpl . '/' . $section . $order . '.html';
641 $output['page'] .= 'even-' . $section . '-name: html_' . $section . $order . ';' . DOKU_LF;
643 $output['page'] .= 'odd-' . $section . '-name: html_' . $section . $order . ';' . DOKU_LF;
654 '@PAGES@' => '{nbpg}', //see also $mpdf->pagenumSuffix = ' / '
655 '@TITLE@' => hsc($this->title),
662 '@TPLBASE@' => DOKU_BASE . 'lib/plugins/dw2pdf/tpl/' . $this->tpl . '/',
663 '@TPLINC@' => DOKU_INC . 'lib/plugins/dw2pdf/tpl/' . $this->tpl . '/'
669 $output['html'] = $this->pageDependReplacements($html, $ID);
672 $coverfile = DOKU_PLUGIN . 'dw2pdf/tpl/' . $this->tpl . '/cover.html';
676 $output['cover'] = $this->pageDependReplacements($output['cover'], $ID);
681 $backfile = DOKU_PLUGIN . 'dw2pdf/tpl/' . $this->tpl . '/back.html';
686 $output['back'] = $this->pageDependReplacements($output['back'], $ID);
690 $citationfile = DOKU_PLUGIN . 'dw2pdf/tpl/' . $this->tpl . '/citation.html';
710 if ($this->getConf('qrcodescale')) {
712 $size = (float)$this->getConf('qrcodescale');
714 '<barcode type="QR" code="%s" error="Q" disableborder="1" class="qrcode" size="%s" />',
716 $size
737 if ($event->advise_before()) {
741 // plugins may post-process HTML, e.g to clean up unused replacements
742 $event->advise_after();
757 * e.g. '%m(30-11-1975)' is replaced by '11'
790 $this->cssPluginPDFstyles(),
793 DOKU_PLUGIN . 'dw2pdf/tpl/' . $this->tpl . '/style.css' =>
794 DOKU_BASE . 'lib/plugins/dw2pdf/tpl/' . $this->tpl . '/',
807 // compatiblity layer for pre-Greebo releases of DokuWiki
812 $styleini = $styleUtils->cssStyleini($conf['template']); // older versions need still the template
832 $usestyle = explode(',', $this->getConf('usestyles'));
880 return $this->list;
893 return -1;
924 if ($i === ($countA - 1) || $i === ($countB - 1)) {
927 return -1;
937 return -1;
964 $this->exportConfig = [];
967 $this->exportConfig['pagesize'] = $INPUT->str('pagesize', $this->getConf('pagesize'), true);
968 $this->exportConfig['orientation'] = $INPUT->str('orientation', $this->getConf('orientation'), true);
970 // decide on the font-size from param or config
971 $this->exportConfig['font-size'] = $INPUT->str('font-size', $this->getConf('font-size'), true);
973 $doublesided = $INPUT->bool('doublesided', (bool)$this->getConf('doublesided'));
974 $this->exportConfig['doublesided'] = $doublesided ? '1' : '0';
976 $this->exportConfig['watermark'] = $INPUT->str('watermark', '');
978 $hasToC = $INPUT->bool('toc', (bool)$this->getConf('toc'));
981 $toclevels = $INPUT->str('toclevels', $this->getConf('toclevels'), true);
982 [$top_input, $max_input] = array_pad(explode('-', $toclevels, 2), 2, '');
983 [$top_conf, $max_conf] = array_pad(explode('-', $this->getConf('toclevels'), 2), 2, '');
1014 $levels["H$level"] = $level - 1;
1017 $this->exportConfig['hasToC'] = $hasToC;
1018 $this->exportConfig['levels'] = $levels;
1020 $this->exportConfig['maxbookmarks'] = $INPUT->int('maxbookmarks', $this->getConf('maxbookmarks'), true);
1022 $tplconf = $this->getConf('template');
1023 $tpl = $INPUT->str('tpl', $tplconf, true);
1030 $this->exportConfig['template'] = $tpl;
1032 $this->exportConfig['isDebug'] = $conf['allowdebug'] && $INPUT->has('debughtml');
1044 if ($this->exportConfig === null) {
1045 $this->loadExportConfig();
1048 return $this->exportConfig[$name] ?? $notset;
1052 * Add 'export pdf'-button to pagetools
1060 if ($this->getConf('showexportbutton') && $event->data['view'] == 'main') {
1069 $event->data['items'] = array_slice($event->data['items'], 0, -1, true) +
1074 $this->getLang('export_pdf_button'),
1075 $this->getLang('export_pdf_button')
1077 array_slice($event->data['items'], -1, 1, true);
1089 if ($event->data['view'] != 'page' || !$this->getConf('showexportbutton')) {
1097 array_splice($event->data['items'], -1, 0, [new MenuItem()]);
1114 $tr = $trans->getLangPart($pageid);