plugin:dw2pdf
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:dw2pdf [2016-07-22 06:16] – [Headers and Footers] jjensen | plugin:dw2pdf [2023-11-25 23:50] (current) – version upped andi | ||
---|---|---|---|
Line 6: | Line 6: | ||
email : andi@splitbrain.org, | email : andi@splitbrain.org, | ||
type : action, renderer | type : action, renderer | ||
- | lastupdate : 2016-04-17 | + | lastupdate : 2023-11-25 |
- | compatible : Weatherwax, Binky, Ponder Stibbons, Hrun, | + | compatible : !Greebo, Hogfather, Igor, Jack Jackrum |
depends | depends | ||
conflicts | conflicts | ||
Line 22: | Line 22: | ||
===== Download and Installation ===== | ===== Download and Installation ===== | ||
- | Download | + | Search |
- | :!: The plugin | + | Only **PHP 7.4 up to PHP 8.1** are supported by dw2pdf |
- | To export images with an alpha channel (used for transparency), | + | To export |
- | sudo apt-get install | + | sudo apt-get install |
Also see the [[: | Also see the [[: | ||
Line 42: | Line 42: | ||
===== Features ===== | ===== Features ===== | ||
- | * Uses the [[http://www.mpdf1.com/|mPDF]] PHP library. | + | * Uses the [[https://mpdf.github.io|mPDF]] PHP library. |
* Handles different languages (it bundles the large, but relatively complete Unicode font). | * Handles different languages (it bundles the large, but relatively complete Unicode font). | ||
* Easy customizing through headers, footers and CSS | * Easy customizing through headers, footers and CSS | ||
Line 48: | Line 48: | ||
* Use with the [[plugin: | * Use with the [[plugin: | ||
- | Since 11 June 2015 version | + | Since July 2017 version |
- | * Release based at previous mPDF version -- [[https:// | + | |
- | ===== Installation ===== | + | As (temporary) fallback the following old releases could be found: |
+ | * Since 11 June 2015 version 6.0 of the mPDF library was included. This should significantly improve the styling possibilities. However there could also be regressions. \\ Release based at previous mPDF 6.0 version -- [[https:// | ||
+ | * Release based at previous mPDF 5.7.4 version -- [[https:// | ||
- | To use the plugin, you simply need to call the page passing it a //"do=export_pdf"// PHP argument for a single | + | ===== Usage ===== |
+ | There are three ways to export: | ||
+ | * **Export one page**\\ You simply need to call the page with an additional '' | ||
+ | * **Export an entire namespace**\\ There is the URL parameter '' | ||
+ | * **Export selection of pages**\\ If you need to select just some pages to export to one PDF, you can use [[plugin: | ||
- | See the [[#Syntax|syntax]] section on how to export | + | ===== HowTo' |
+ | Please refer to the following pages to learn how to use or support | ||
+ | * Set [[plugin: | ||
+ | * [[plugin: | ||
+ | * [[plugin: | ||
+ | * Plugin developers: [[plugin: | ||
- | ==== DokuWiki template ==== | ||
- | {{: | ||
- | |||
- | ==== Default template ==== | ||
- | |||
- | Use the following to add another button in the upper or bottom button row of the default template((In ''/ | ||
- | |||
- | <code html> | ||
- | <form class=" | ||
- | <div class=" | ||
- | <input type=" | ||
- | <input type=" | ||
- | <input type=" | ||
- | <input type=" | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | Or use this for a simple 16x16 icon somewhere in your template: | ||
- | |||
- | <code html> | ||
- | <a href="<? | ||
- | <img src="<? | ||
- | </a> | ||
- | </ | ||
- | |||
- | You can mix the 2 previous methods, and get a button with an image inside, with this code: | ||
- | |||
- | <code html> | ||
- | <form class=" | ||
- | <div class=" | ||
- | <button type=" | ||
- | <img src="<? | ||
- | Export to PDF | ||
- | </ | ||
- | <input type=" | ||
- | <input type=" | ||
- | <input type=" | ||
- | </ | ||
- | </ | ||
- | </ | ||
- | |||
- | ==== Monobook Template ==== | ||
- | |||
- | When using the template " | ||
- | |||
- | <code php> | ||
- | //PDF plugin: export tab | ||
- | if (file_exists(DOKU_PLUGIN." | ||
- | !plugin_isdisabled(" | ||
- | $_monobook_tabs[" | ||
- | $_monobook_tabs[" | ||
- | } | ||
- | </ | ||
- | |||
- | Add translation to file ''/ | ||
- | |||
- | <code php> | ||
- | $lang[" | ||
- | </ | ||
- | |||
- | ==== Typo Template ==== | ||
- | |||
- | When using the [[template: | ||
- | |||
- | <code php> | ||
- | print '< | ||
- | </ | ||
- | |||
- | ==== How-to auto-add export button in your template ==== | ||
- | |||
- | When your template has implemented the trigger for the [[devel: | ||
- | |||
- | In the '' | ||
===== Syntax ===== | ===== Syntax ===== | ||
Line 143: | Line 79: | ||
Handling of [[config: | Handling of [[config: | ||
- | ===== Configuration ===== | ||
- | The plugin provides a few configuration settings that can be configured in the [[plugin: | ||
- | |||
- | * ** Only via url-parameters: | ||
- | |||
- | ==== Document Title ==== | ||
- | |||
- | '' | ||
- | * '' | ||
- | '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | Cookie '' | ||
- | * '' | ||
- | |||
- | * ** Override-able via url-parameters: | ||
- | |||
- | If a url-parameter is provided, that value is used, otherwise the plugin config setting from the Configuration Manager is used. | ||
- | |||
- | ==== Pagesize ==== | ||
- | |||
- | '' | ||
- | A page format as supported by mPDF. Usually '' | ||
- | |||
- | ==== Orientation ==== | ||
- | |||
- | '' | ||
- | Page orientation of the whole document, you can select '' | ||
- | |||
- | Also you can change the orientation of only some pages. Adding the syntax will change the orientation, | ||
- | |||
- | ~~PDF: | ||
- | ~~PDF: | ||
- | |||
- | ==== Double-sided document ==== | ||
- | |||
- | '' | ||
- | By default a double-sided PDF document is outputted. The first page is an odd page (left hand-side page) and further even-odd page pairs are added. Disabling this will output a single-sided document with only odd pages. The single-sided document doesn' | ||
- | |||
- | ==== Table of Contents ==== | ||
- | |||
- | '' | ||
- | '' | ||
- | An auto-generated Table of Contents can be included by enabling the setting ' | ||
- | |||
- | ==== Bookmarks ==== | ||
- | |||
- | '' | ||
- | By default the plugin generates PDF bookmarks for each headline in the source page. You can lower the number here to include only higher level headlines in the bookmarks. Set it '' | ||
- | |||
- | ==== Template ==== | ||
- | |||
- | '' | ||
- | Choose which PDF template (see below) should be used by default. The template can be overridden with the '' | ||
- | |||
- | |||
- | * ** Only via configuration manager: ** | ||
- | |||
- | ==== Output Control ==== | ||
- | |||
- | The '' | ||
- | |||
- | ==== Caching ==== | ||
- | |||
- | By default, generated PDFs are cached. This includes embedded images. This means the ACLs for embedded images will not be rechecked when a user requests a cached PDF. If this is a problem, you should disable caching. | ||
- | |||
- | ==== Plugin Styles ==== | ||
- | |||
- | The plugin automatically uses '' | ||
- | |||
- | ==== QR code==== | ||
- | |||
- | Via a placeholder a QR code can be added in the pdf-templates, | ||
- | |||
- | ==== Show export button ==== | ||
- | |||
- | Lets you show or hide the toolbar button in the pagetools. | ||
- | |||
- | ==== Plugin Compatibility ==== | ||
- | |||
- | To work with other plugins you have to add '' | ||
- | var $supportedModes = array(' | ||
- | Otherwise you may have problems with caching. | ||
- | |||
- | ===== PDF Templates ===== | ||
- | |||
- | Templates define the design of the created PDF files and are a good way to easily customize them to your Corporate Identity. | ||
- | |||
- | To create a new template, just create a new folder within the plugin' | ||
- | |||
- | ==== Headers and Footers ==== | ||
- | |||
- | The following files can be created and will be used to set headers and footers on odd or even pages. Special headers/ | ||
- | |||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | |||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | |||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | |||
- | You can use all HTML that is understood by mpdf (See http:// | ||
- | |||
- | If you reference image files from your pdf-template file, be sure to prefix them with the @TPLBASE@ parameter (See [[# | ||
- | |||
- | ==== Replacements ==== | ||
- | |||
- | The following replacement patterns can be used within the header and | ||
- | footer files. | ||
- | |||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | |||
- | //Remark about Bookcreator//: | ||
- | The page dependent replacements are only for '' | ||
- | In the headers and footers the ID of the bookmanager page of the Bookcreator is applied. | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | * '' | ||
- | |||
- | ==== Styles ==== | ||
- | |||
- | Custom stylings can be provided in the following file of your pdf-template folder: | ||
- | |||
- | * style.css | ||
- | |||
- | You can use all the CSS that is understood by mpdf (See http:// | ||
- | |||
- | ===== For developers ===== | ||
- | |||
- | If you're a plugin developer and want to make your syntax plugin compatible with the PDF export, here are a few tips: | ||
- | |||
- | * provide a useful '' | ||
- | * if you want to use special stylings for PDF export provide a '' | ||
- | * your HTML and CSS should be simple enough to be understood by mpdf (see [[http:// | ||
- | |||
- | If you want to provide custom HTML for the PDF export you should check if the renderer is a '' | ||
- | |||
- | <code php> | ||
- | function render($mode, | ||
- | if($mode == ' | ||
- | | ||
- | // this is the PDF export, render simple HTML here | ||
- | | ||
- | // this is normal XHTML for Browsers, be fancy here | ||
- | } | ||
- | | ||
- | } | ||
- | return false; | ||
- | } | ||
- | </ | ||
- | |||
- | By default, '' | ||
- | |||
- | <code php> | ||
- | $R->doc .= '< | ||
- | </ | ||
===== Issues and Requests ===== | ===== Issues and Requests ===== | ||
- | Please report issues and requests in the issue tracker: https:// | + | Please report issues and requests in the issue tracker:\\ https:// |
==== How to collect more debug info? ==== | ==== How to collect more debug info? ==== | ||
- | If you are using the dw2pdf plugin and you don't get the wanted output, than you might investigate the data during its workflow. The dw2pdf plugin uses the HTML code of the print version of an wiki article and converts this code with the mPDF-library to a pdf-file. | + | If you are using the dw2pdf plugin and you don't get the wanted output, than you might investigate the data during its workflow. The dw2pdf plugin uses the HTML code of the print version of an wiki article |
Some options to investigate with the intermediate results are: | Some options to investigate with the intermediate results are: | ||
- Look at the print preview of an article via the print preview function of your browser | - Look at the print preview of an article via the print preview function of your browser | ||
- | - Output | + | - Output |
- | **How-to** output plain html (just before it is inputted in the mPDF library): | + | **How-to** output |
- Enable the debugging mode of the wiki with the [[config: | - Enable the debugging mode of the wiki with the [[config: | ||
- Add url-parameter to the url used to initiate your pdf-export (copy and modify the link of the button or url you use): | - Add url-parameter to the url used to initiate your pdf-export (copy and modify the link of the button or url you use): | ||
Line 337: | Line 99: | ||
* Adding ''& | * Adding ''& | ||
- | See for the debugging options of the mPDF library related to images: | + | See for the debugging options of the mPDF library related to images: |
===== Sites using this plugin ===== | ===== Sites using this plugin ===== | ||
Feel free to add yours here: | Feel free to add yours here: | ||
- | * [[http:// | ||
- | * [[http:// | ||
* [[http:// | * [[http:// | ||
- | * [[http:// | + | * [[http:// |
- | * [[http:// | + | * [[http:// |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
* [[http:// | * [[http:// | ||
- | * [[http:// | + | * [[http:// |
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
* [[http:// | * [[http:// | ||
- | * [[http://www.estechnical.co.uk/docs|ESTechnical Documentation (English)]] | + | * [[https://webge.fr/dokuwiki|WEBGE wikis (french)]] |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | * [[http:// | + | |
- | ===== Linked Images | + | ===== Other info ===== |
+ | ==== Linked Images ==== | ||
Not all image format variations are successfully embedded in the PDF, even if they are properly displayed in DokuWiki. If you get missing images in your output, try stripping the Alpha channel of your (e.g. PNG) images. | Not all image format variations are successfully embedded in the PDF, even if they are properly displayed in DokuWiki. If you get missing images in your output, try stripping the Alpha channel of your (e.g. PNG) images. | ||
Line 371: | Line 124: | ||
If using full http links, make sure the permissions are set up for retrieving the image directly (test in a browser). DokuWiki may prevent outside access to images in the data/media directory. | If using full http links, make sure the permissions are set up for retrieving the image directly (test in a browser). DokuWiki may prevent outside access to images in the data/media directory. | ||
- | ===== Password protection of generated documents | + | ==== Password protection of generated documents ==== |
To set fixed password for generated documents, edit: | To set fixed password for generated documents, edit: | ||
- | '' | + | '' |
and add following lines: | and add following lines: | ||
Line 386: | Line 139: | ||
(filips) | (filips) | ||
- | ===== iPhone/iPad ===== | ||
- | When using with an iPhone/iPad disable | + | ==== Hyphenation ==== |
- | otherwise this plugin | + | |
+ | With the following | ||
+ | < | ||
+ | body { | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | The hyphenation is of course language dependent. Normally, the wiki login language is used. If the [[translation|translation | ||
- | ==== Discussion | + | ==== Rendering Limitations |
- | === Linked Images === | + | |
- | Is it possible to somehow add a tutorial for how to get external embedded images into the pdf? i'd really appreciate that. | + | |
- | === Date format example === | + | |
- | An example for the footer HTML placeholder / variable to show just the Year so that you can add a dated copyright notice : ''& | + | |
- | === Disable Hyperlinks in export === | + | |
- | Is there a way to disable all hyperlinks in the pdf export? | + | |
- | === Additional config pages === | + | Because |
- | Feature request : Can we have a footer_last.html and header_last.html for the back cover page or front cover page? | + |
plugin/dw2pdf.1469160963.txt.gz · Last modified: 2016-07-22 06:16 by jjensen