It's better when it's simple

User Tools

Site Tools


⇐ epub Plugin Page


[20-4-2016] Question on functioning

Is there a way to make it possible to use the epub plugin in a similar way as the dw2dg PDF plugin and the .ODT plugin - a simple button on the toolbar on the right where people can just click to have a namespace being made into a epub-file?

I have a DokuWiki with a text-archive. The plan is that people can download for instance a text like this in different formats (Word, PDF, ePub):

Kind regards,


Afraid not — Myron TurnerMyron Turner

2016-04-20 00:55
How do they to this here then? Because it seems to involve almost no calculation or file-generation: Kind regards, T 2016-04-20 22:00
You might want to adapt this: — Myron TurnerMyron Turner

2016-05-07 17:50

Warning: Cannot modify header information

After install plugin epub i have Warning: Cannot modify header information - headers already sent by (output started at /var/www/web1/html/start/dokuwiki/lib/plugins/epub/helper.php:1) in /var/www/web1/html/start/dokuwiki/inc/actions.php on line 180 How can i fix this problem? What´s wrong?

Dokuwiki version “Angua” Plugin epub turnermm-epub-f8dfcf5

Best regards!

I've checked the helper.php file and there is nothing wrong with it. Normally these problems occur when there is a white space error, when white space is output from a php file before the http headers are output byt Dokuwiki. You can check for this using findbad.php.
I see that you have used a github repository, and if that is correct, then it was committed in July 2012, so I'm not sure where you found it. If you installed it manually, then an error could have crept in when the uploading using ftp, particularly if you are uploading from Windows. Delete that version of epub and install it using the plugin manager from the link which is found on the plugin page, which is
I could not reproduce this error. Try to uninstall the plugin and install using the plugin manager. The error suggests that there are extra lines or spaces at the top of the file helper.php. But this is not the case, unless spaces or lines have been inserted upon upload by your ftp client. This could happen if you ftp from a Windows machine to a *nix machine.

I have the same problem. I installed the plugin using the plugin manager and no Windows machine is involved anywhere.

Thanks and best regards!

Again I cannot reproduce this error. I've tested all versions of epub on Centos under Angua and the main version on OS X under Angua. Please give fuller details: server, version of epub, version of PHP, etc. And if need be, move this discussion over to the dokuwiki forum and attach your copy of helper.php.

The problem with the warnings seems to be coming from “BOM” markers at the beginning of lots of the epub plugin files, not just header.php. It's not a good idea to leave these invisible BOM bytes in php files - you need to use an editor that allows you to choose to save files without the BOM. Once I removed all the BOM markers the epub plugin works without any annoying warning messages!

Should now be fixed. Every once in a while my editor loses its settings, and without my realizing, it must at one point have re-set its default to save as UTF8 with BOM. I'm glad I found this out. This happened to me once before (I believe) when updating fckgLite but I couldn't track down the source of the problem.

Hi! Great plugin! Sadly it seems to me that it fail to export images used by .css. I use the wrap plugin that create div with a background image. In the rendered epub html there are correct classes, but in the style.css I found a long relative path like this

.dokuwiki div.wrap_info { background-image: url(/project/lib/plugins/wrap/images/note/48/info.png); }

and the folder OEBPS/images is empty.

To begin with, epub replaces urls with footnotes linking to the urls, so that the urls do not appear in the body of the text and do not use css images. The wrap plugin may be an exception. While I can fix the path easily enough, identifying which elements require css images is another story. The epub plugin takes its output from the dokuwiki renderer; css images are inserted by the browser. Whether or not ebook readers would do the same, I don't know. If you find such a case let me know.

Ok, I understood. I decided to simply fix the rendered EPUB with Calibre: I corrected image's URL in the .css and then I manually added the /images/ folder with the wrap plugin's images. Thanks
I'm glad you were able to fix this. It turns out, then. that Calibre does recognize the css/url image setting. Would it be possible to send me a copy of your ebook? Also, I wasn't aware that Calibre had an option for altering ebooks. Is it a plugin? Thanks. — Myron TurnerMyron Turner

2012/12/20 18:23

can I set a footer for every “page”?

Hello. The message while creating does not dissapear at the end…

processed: test:test 
Using LESS: css3.php
found Title Page for Text/title.html
found Test for Text/test_test.html
packing epub
ziparchive used
rm -f -r /var/www/dokuwiki/data/meta/epub/user/4d9f635cc7bdbc6a9855e1df32a8f45e/

I use Binky. What informations do you need to know more about my problem?


I'm not sure what you mean. When the page is reloaded the processing output disappears and you have instead the Start button and the Remove page. . . button and the descriptions of what these buttons do.

Hello. How can I swap my own eBook stylesheet?

An epub book is packed as a zip file. You can add the .zip extension to the file and open it up. There you will find a directory name OEBPS/Styles. You modify the style sheet there. Or you can modify your style sheet by adding styles to conf/userstyle.css which will modify your wiki. You create that file if it doesn't exist. You can always remove it.


Aligned Images

I have changed the code of renderer.php slightly. I added an argument $align to set_image as follows:

    function set_image($img,$width=null,$height=null, $align='') {
        if($width)   $w= ' width="' . $width . '"';
        if($height)   $h= ' height="' .$height . '"';
        $img = $this->clean_image_link($img);
        $cls = 'media';
        if ($align == 'left' || $align == 'right')
             $cls .= $align;
        //echo hsc('<img src="' . $img . '"' .  "$h $w " . ' alt="'. $img . '" class="media" />') ."\n";
        return '<img src="' . $img . '"' .  "$h $w " . ' alt="'. $img . '" class="'.$cls.'" />';

Then, in _media(), line 94, I passed $align down to set_media(). Now, all image align correctly to the left or the right. Maybe also center alignment works without an embedding div, I did not try. You may want to change renderer.php accordingly (medialeft and mediaright classes are standard Dokuwiki classes).


I've taken up this suggestion, and the centering was easily enough done using the alignment add-on. The media class is left by default and so does not get the add-on. Thanks for the interest — Myron TurnerMyron Turner

2016-04-16 17:19

2017-12-06: Regarding the list of pages

Nice plugin. Thanks a lot.

It seems the list of pages only admits internal names. Also, only absolute paths work. I'd rather use natural names and relative paths.

2018-29-08: Hierarchical Table of Contents conversion

This is so much easier than SiteExport! Congratulations on a great plugin. It would be very nice to support conversion of a hierarchical Table of Contents expressed perhaps in this way:

<epub:OpenCPN User Manual>
[[opencpn:opencpn_user_manual|OpenCPN User Manual]]
  * [[opencpn:opencpn_user_manual:getting_started|Getting Started]]
    * [[opencpn:opencpn_user_manual:getting_started:opencpn_installation|Installation]]
      * [[opencpn:opencpn_user_manual:getting_started:opencpn_installation:windows|Windows]]
      * [[opencpn:opencpn_user_manual:getting_started:opencpn_installation:ubuntu_ppa|Ubuntu PPA]]
      * [[opencpn:opencpn_user_manual:getting_started:opencpn_installation:linux|Linux]]
    * [[opencpn:opencpn_user_manual:getting_started:opencpn_first_use|First Use]]
    * [[opencpn:opencpn_user_manual:getting_started:gps_setup|GPS Setup]]
    * [[opencpn:opencpn_user_manual:getting_started:chart_installation|Chart Installation]]
  * [[opencpn:opencpn_user_manual:getting_around|Getting Around]]
    * [[opencpn:opencpn_user_manual:getting_around:gps_setup_and_status|GPS Setup and Status]]
    * [[opencpn:opencpn_user_manual:getting_around:display_orientation|Display Orientation]]
    * [[opencpn:opencpn_user_manual:getting_around:chart_status_bar|Chart Status Bar]]
  * [[opencpn:opencpn_user_manual:charts|CHARTS]]
    * [[opencpn:opencpn_user_manual:charts:chart_files_tab|Chart Files Tab]]
    * [[opencpn:opencpn_user_manual:charts:vector_display_tab|Display Tab]]
    * [[opencpn:opencpn_user_manual:charts:chart_groups_tab|Chart Groups Tab]]
    * [[opencpn:opencpn_user_manual:charts:chart_downloader_tab|Chart Downloader Tab]]
    * [[opencpn:opencpn_user_manual:charts:chart_manual_installation|Chart Manual Installation]] 

Etc Rick Gleasonrgleason


The other thing I notice is that the nice Dokuwiki internal title links don't seem to convert and end up as errors. If there is some way to have these convert into ebook it would be great, but I haven't found an equivalent feature. These have this type of format with the title after the #.

[[:opencpn:opencpn_user_manual:charts:chart_sources#high_resolution_background_map| High Resolution Background GSHHS Shoreline]]  \\ 

Also I found this manual for conformant epub links and Table of Contents. It appears the #title format is supported.

Thank you Rick Gleasonrgleason


The link fragment syntax – [[page_id#title]] – is now supported. See: links. — Myron TurnerMyron Turner

2018-08-31 01:30

2019-31-03: Exclude pages from namespace

Is there a syntax to exclude certains pages (as sidebar, start or _template) from the namespace listing generation? The automatic listing of namespcace is great but an exclude option is needed. An option to take name from first heading instead of file name would be also really welcome.

There is also a small bug in the generated link for the ePub after processing. The link is malformed like that http://domain.comhttp// It's easy to correct it to have the functional link but I don't know where to correct this link generation ?


2019-03-31 23:10


Myron TurnerMyron Turner

2019-04-01 02:23

plugin/epub/discussion.txt · Last modified: 2019-04-01 02:23 by turnermm