Luigi Micco homepage

vbPDF, vbPDFParser, vbQRCode, vbDataMatrix, vbPDF417, vbAztec, clsPDFCreator, vbGCalendar

Strumenti Utente

Strumenti Sito


Barra laterale

I miei progetti

Donazioni

Se quello che hai trovato in queste pagine ti e' stato in qualche modo d'aiuto, puoi contribuire con una donazione!

Donazioni

oppure puoi cliccare su uno dei banner presenti qui.

dokuwiki:dw2pdf

  • Esporta in OpenOffice
  • Esporta in PDF
  • Agg./Rimuovi selezione
  • Strumenti:

Dw2pdf plugin

Export DokuWiki content to PDF

Download and Installation

Download and install the plugin using the DokuWiki Plugin Manager using the URL given above. Refer to :DokuWiki Plugins on how to install plugins manually.

Note: If you do install manually the directory must be named dw2pdf.

Overview

The goal of this plugin was to provide a simple, ready to go PDF converter that almost faithfully replicates the screen view of your wiki pages (i.e. doesn't convert them to a print-document format like the latex plugin). It also bundles the necessary fonts and libraries (hence the 14M size) so that you should not need to do any configuration to get it up and running as quickly as possible. I haven't thoroughly tested this point on many platforms yet, so any feedback is welcome.

Features

  • Uses the mPDF version 4.4 PHP library.
  • Handles different languages (it bundles the large, but relatively complete Unicode font).
  • Outputs graphics of reasonable quality.
  • custom headers and footers
  • custom CSS to control PDF output
  • automatic index of bookmarks
  • with Bookcreator Plugin allow to made a PDF from only selected pages

Installation

To use the plugin, you simply need to call the page passing it a ”do=export_pdfPHP argument. The easiest way to implement this is to add a button or similar somewhere in your template design.

Default template

Use the following to add another button in the upper or bottom button row of the default template1)

1) In /lib/tpl/default/main.php, there are two divs that contain some buttons:
and
. Just insert the HTML code inside one of the two divs (left or right) )) <code> <form class=“button” method=“get” action=”<?php wl($ID)?>”>
  <input type="submit" value="Export to PDF" class="button" />
  <input type="hidden" name="do" value="export_pdf" />
  <input type="hidden" name="id" value="<?php echo $ID?>" />
</div>
</form></code>Or use this for a simple 16×16 icon somewhere in your template:
  <a href="<?php echo exportlink($ID, 'pdf')?>"><img src="<?php echo DOKU_BASE?>lib/images/fileicons/pdf.png" alt="PDF Export" /></a>
You can mix the 2 previous methods, and get a button with an image inside, with this code:
<form class="button" method="get" action="<?php wl($ID)?>">
  <div class="no">
    <button type="submit" class="button">
      <img src="<?php echo DOKU_BASE?>lib/images/fileicons/pdf.png" alt="PDF Export" />
      Export to PDF
    </button>
    <input type="hidden" name="do" value="export_pdf" />
    <input type="hidden" name="id" value="<?php echo $ID?>" />
  </div>
</form>

Monobook

When using the template ”monobook for DokuWiki”, to have an Export PDF tab, in /user/tabs.php, use this code
//PDF plugin: export tab
if (file_exists(DOKU_PLUGIN."dw2pdf/action.php") &&
    !plugin_isdisabled("dw2pdf")){
    $_monobook_tabs["tab-export-pdf"]["text"] = $lang["monobook_tab_exportpdf"];
    $_monobook_tabs["tab-export-pdf"]["href"] = wl(getID(), array("do" => "export_pdf"), false, "&");
}

Typo

Add this code in lib/tpl/typo/tpl_functions.php just before “print ' </ul>' . DOKU_LF;”
print '<li>'.tpl_link(wl($ID,'do=export_pdf'), 'Export PDF', 'class="action export_pdf" rel="nofollow"',1).'</li>'.DOKU_LF

Issues and Requests

This package uses a library maintained by someone else which is just focusing on converting DokuWiki content to PDF.

Version history

  • 2010-04-02 (current)
    • add support for set a title when use BookCreator plugin (only file updated (action.php) from previous release is available here)
  • 2010-03-31
    • support for bookmarks
    • removed bug on UTF-8 encoding
    • add German language to admin side (Thanks to Karl Grohmüller)
    • support for BookCreator plugin: allow to made a PDF from selected pages
  • 2010-03-15
    • support for admin-side configuration
    • support for custom header and footer (see below)
    • support for language (now English and Italian)
    • support for user defined CSS (see below)
    • now is possible to decide if download file or open PDF into browser
    • configurable list of tags to ignore
  • 2010-03-07
    • correct use of tmpalphadir value
  • 2010-03-04
    • add support for pagebreak of WRAP and PAGEBREAK plugins (Thanks to Joachim and Laurent Mander for suggestion);
    • removed bug on ACLs rights
  • 2010-02-26
    • solved bug on ampersands (&) (Thanks to Jared Ong for suggestion and coding hints);
    • solved problem with tag we don’t want rendered completely out (Thanks to Jared Ong for suggestion and coding hints);
  • 2010-02-14
    • setting TEMP directory (Thanks to Yann Cochard for suggestion);
    • setting name for PDF file (Thanks to Karl Grohmueller for suggestion);
    • solved bug on table border;
    • reduce script size and memory usage (mPDF file size 646 kB, memory usage on loading mPDF class 6.25 MB);
  • 2010-01-26
    first release

Customizing

Custom header/footer

To customize header or footer (for odd or even pages), You can use this substitution patterns:
@ID@ full ID of the page
@PAGE@ page number
@PAGES@ number of total pages
@TITLE@ first heading of the current page
@WIKI@ title of the wiki as configured in title
@WIKIURL@ wiki URL
@DATE@ current date (use dformat function)
@PAGEURL@ permanent page link
==== CSS ==== The place for all user-defined, custom stuff is “dw2pdf/user/user.css”. Reason: this file will not be touched on updates.

Development Roadmap

In development

  • verify images resizing problem.
dokuwiki/dw2pdf.txt · Ultima modifica: 10/05/2012 18:39 (modifica esterna)

Strumenti Pagina