How can I directly convert docx to ePub in PHP?

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

I know Java solutions (e.g. http://code.google.com/p/epub-tools/ ) and the 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 on click) to ePub using PHP.

Does anyone know of a solution that can do this?

EDIT

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

+4
source share
2 answers

Although I could not find a direct solution for this, I found the following simple solution for converting from docx to ePub.

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

An example of this is available here:

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

+3
source

I am afraid that the only direct solution for converting from DOCX to EPUB is the .NET component created by Aspose .

One possible indirect way (I have not tested this):

  • Convert DOCX to DocBook XML (see this SO thread - I think you can manage your OpenOffice server using PHP).
  • Use DocBook XSLT to convert DocBook XML to EPUB (can be done with PHP, see libxslt).
+5
source

All Articles