Search code examples
phpepub

How can I directly convert docx to ePub in PHP?


Trying to find a PHP library that will enable me to convert docx to ePub.

I'm aware of Java solutions (e.g. http://code.google.com/p/epub-tools/), and PHP classes used to create ePub files (e.g. http://sourceforge.net/projects/oplsepublibrary/).

But what I'm looking for is a direct conversion from docx (or PDF at a push) to ePub using PHP.

Is anyone aware of solution that can achieve this?

EDIT

I have added a link in my answer below to a solution that I have developed to achieve this. The solution is available on Github at: https://github.com/benskay/PHP-Digital-Format-Convert-Epub-Mobi-PDF


Solution

  • Though I haven't been able to find a direct solution for this, I have found the following simple solution for converting from docx to ePub.

    • Firstly, use PHPDocx to export xHTML from the docx file
    • Then, use the EPub class to convert the exported HTML into an ePub file.

    An example of this is available here:

    https://github.com/benskay/PHP-Digital-Format-Convert-Epub-Mobi-PDF