DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:pdfexport

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
tips:pdfexport [2010-11-10 15:29] 91.91.185.208tips:pdfexport [2015-04-26 10:46] – old revision restored (2013-10-03 03:40) 2001:4dd0:ff00:8eb9:e1a5:925a:f67:907
Line 1: Line 1:
-====== Export DokuWiki Page to PDFs ====== +====== Export DokuWiki Pages to PDFs ====== 
-Several users proposed a way how to convert your HTML wiki pages to PDFs. Therefore you'll find 3 different solutions to the same problem on this page and another one on [[plugin:pdfdownload]]The page [[discussion:exporting_pdf]] may be of interest, too..+Several methods exist to convert your wiki pages to PDFs. See also the full list of [[https://www.dokuwiki.org/plugins?plugintag=pdf#extension__table|plugins tagged 'PDF']].
  
-You can also see this page [[tips:pdfexport:htmldoc]]or generate OpenOffice documents from your wiki using [[plugin:odt]], as OpenOffice provides native export to PDF (working hyperlinks, tables, images and more).+Plugins that export directly to PDF: 
 +  * [[plugin:dw2pdf]] 
 +  * [[plugin:xslfo|XSL-FO]] 
 +  * [[plugin:pdfex]] (old) 
 +  * [[plugin:html2pdf]] (broken) 
 + 
 +Other ways to generate PDFs: 
 +  * HTML to PDF converter: [[tips:pdfexport:HTMLDOC]]or 
 +  * Generate ODT documents from your wiki using the [[plugin:odt|ODT plugin]], as LibreOffice, OpenOffice, etc. provide means to export to PDF (with working hyperlinks, tables, images and more).
  
 ===== Common changes ===== ===== Common changes =====
 In order to export your pages to PDF you'll need to add a button to your wiki. Regardless which PDF converter you use, you need to implement the following changes: \\ In order to export your pages to PDF you'll need to add a button to your wiki. Regardless which PDF converter you use, you need to implement the following changes: \\
  
-  * Add an //Export to PDF// button by editing ''lib/tpl/main.php'' like so: <code php>+  * Add an //Export to PDF// button by editing ''lib/tpl/default/main.php'' like so: <code php>
     <div class="bar" id="bar_top">     <div class="bar" id="bar_top">
       <div class="bar-left" id="bar_topleft">       <div class="bar-left" id="bar_topleft">
Line 32: Line 40:
 }else{ }else{
   $ret .= '<input type="submit" value="'.htmlspecialchars($label).'" class="button" ';   $ret .= '<input type="submit" value="'.htmlspecialchars($label).'" class="button" ';
 +}
 +</code>
 +
 +==== Dokuwiki-template: Export Link in Pagetools ====
 +In order to have an export-link below the "Back to top"-link do the following:
 +  * Add a new string (different from above) to ''inc/lang/de/lang.php'' (or whatever language you use):<code php>
 +$lang['btn_export_pdf'] = 'Als PDF exportieren'; </code>
 +  * Add the following line in ''lib/tpl/dokuwiki/main.php''<code php><!-- PAGE ACTIONS -->
 +            <div id="dokuwiki__pagetools">
 +                <h3 class="a11y"><?php echo $lang['page_tools']; ?></h3>
 +                <div class="tools">
 +                    <ul>
 +                        <?php
 +                            tpl_action('edit',      1, 'li', 0, '<span>', '</span>');
 +                            tpl_action('revert',    1, 'li', 0, '<span>', '</span>');
 +                            tpl_action('revisions', 1, 'li', 0, '<span>', '</span>');
 +                            tpl_action('backlink',  1, 'li', 0, '<span>', '</span>');
 +                            tpl_action('subscribe', 1, 'li', 0, '<span>', '</span>');
 +                            tpl_action('top',       1, 'li', 0, '<span>', '</span>');
 +                            tpl_action('export_pdf',1, 'li', 0, '<span>', '</span>');  <!-- inserted line -->
 +                        ?>
 +                    </ul>
 +                </div>
 +            </div>
 +</code>
 +  * Edit the ''function tpl_get_action($type)'' in file ''inc/template.php'' and add the following condition:<code php>
 +        case 'media':
 +            $params['ns'] = getNS($ID);
 +            break;
 + case 'export_pdf':        <!-- inserted line -->
 + break;            <!-- inserted line -->
 +        default:
 +            return '[unknown %s type]';
 +            break;
 +    }
 +    return compact('accesskey', 'type', 'id', 'method', 'params');
 +}</code>
 +  * Create two new ''export_pdf'' css-actions for the image in ''lib/tpl/dokuwiki/css/pagetools.css'' and add them at the end of the file<code css>
 +#dokuwiki__pagetools ul li a.export_pdf {
 +    background-position: right -270px;
 +}
 +#dokuwiki__pagetools ul li a.export_pdf:before {
 +    margin-top: -270px;
 +}
 +#dokuwiki__pagetools ul li a.export_pdf:hover,
 +#dokuwiki__pagetools ul li a.export_pdf:active,
 +#dokuwiki__pagetools ul li a.export_pdf:focus {
 +    background-position: right -315px;
 } }
 </code> </code>
tips/pdfexport.txt · Last modified: 2015-05-06 18:02 by 12.13.14.15

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki