the author of dokuwiki says it’s print optimized already… no need for a button.

i have got the problem, that if there are large pictures in dokuwiki, than the text size is minimal (not readable).

so i set all pictures to 400px

{{:projects:websites:screenshot.png?400|}}

then it was somewhat ok.

NO KIDDING! YOU WILL HAVE TO DO THIS MANUALLY! THERE IS NO EXTENSION 😀

Here is the code for an export_html button.

create a new file:

lib/tpl/dokuwiki/printview.php

with this content:

<!--?php function _tpl_button_print() { global $ID;  $action = DOKU_BASE . 'doku.php'; $button = <<<BUTTON  <form class="button" method="get" action="$action"> <div class="no"> <input type="hidden" name="do" value="export_html" ?-->
<input name="id" type="hidden" value="$ID" />
<input class="button" title="Print View" type="submit" value="Print" />

BUTTON
;
echo $button;
}
?>

Edit (can be nicely done online from filezilla: r-click -> edit -> should open some basic ascii text editing… just save and it will ask you to upload changes 😉 VERY GOOD :))

lib/tpl/dokuwiki/main.php

And insert those two lines:

<!--?php include('tpl_header.php') ?-->
<!--?php include('printview.php') ?-->

can you spot ‚em?

<!--?php /**  * DokuWiki Default Template 2012  *  * @link     http://dokuwiki.org/template  * @author   Anika Henke <anika@selfthinker.org><br ?--> * @author Clarence Lee <clarencedglee@gmail.com>
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/


if (!defined('DOKU_INC')) die(); /* must be run from within DokuWiki */
header('X-UA-Compatible: IE=edge,chrome=1');

$hasSidebar = page_findnearest($conf['sidebar']);
$showSidebar = $hasSidebar && ($ACT=='show');
?>

<script>// <![CDATA[
(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)
// ]]></script>
<!--?php tpl_metaheaders() ?-->

<!--?php echo tpl_favicon(array('favicon', 'mobile')) ?-->
<!--?php tpl_includeFile('meta.html') ?-->
<!-- [if lte IE 7 ]>
<div id="IE7"><![endif]--><!-- [if IE 8 ]>
<div id="IE8"><![endif]-->

<!--?php include('tpl_header.php') ?-->
<!--?php include('printview.php') ?-->

You can also adapt it for other exports using conditionals or a case statement.

What you will get is such:

print view button dokuwiki

Source: https://forum.dokuwiki.org/thread/8160

admin