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
Next revisionBoth sides next revision
tips:pdfexport [2012-07-18 23:00] – remove old referers Klap-intips:pdfexport [2015-04-26 10:25] 81.65.61.129
Line 1: Line 1:
-====== Export DokuWiki Page to PDFs ====== 
-Several users proposed a way how to convert your HTML wiki pages to PDFs. 
- 
-Current pdf export plugins: 
-  * [[plugin:dw2pdf]] 
-  * [[plugin:pdfex]] (old) 
-  * [[plugin:html2pdf]] (broken) 
- 
-You can also see: 
-  * html to pdf converter: [[tips:pdfexport:HTMLDOC]],  
-  * or generate OpenOffice documents from your wiki using [[plugin:odt]]-plugin, as OpenOffice provides native export to PDF (working hyperlinks, tables, images and more). 
- 
-===== 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: \\ 
- 
-  * Add an //Export to PDF// button by editing ''lib/tpl/main.php'' like so: <code php> 
-    <div class="bar" id="bar_top"> 
-      <div class="bar-left" id="bar_topleft"> 
-        <?php tpl_button('edit')?> 
-        <?php tpl_button('history')?> 
-        <?php print html_btn('exportpdf',$ID,'',array('do' => 'export_pdf')) ?>  <!-- inserted line --> 
-      </div> </code> (If you want the button to appear in the bottom bar use ''id="bar_bottom"'') 
- 
-  * Add a new string to ''inc/lang/en/lang.php'' (or whatever language you use):<code php> 
-$lang['btn_exportpdf'] = 'Export to PDF'; </code> 
  
  
Line 39: Line 14:
 }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