4

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

kaese
  • 10,249
  • 8
  • 29
  • 35

2 Answers2

5

I'm afraid that the only direct solution to convert from DOCX to EPUB is the .NET component made by Aspose.

One possible indirect way (I've not tested this):

  • Convert DOCX to DocBook XML (See this SO thread - I think that you can control OpenOffice server with PHP).
  • Use the DocBook XSLT to convert DocBook XML to EPUB (can be made with PHP, see libxslt).
Community
  • 1
  • 1
fbdcw
  • 829
  • 5
  • 8
3

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

kaese
  • 10,249
  • 8
  • 29
  • 35