export to epub format in php [closed]
Asked Answered
S

2

16

Does anyone know of a php class that can create/export ePub files?

I have a book stored in a mysql database and I wish to publish it as an ePub format book?

It's a very basic book, simple text and chapters, and a few images.

Any suggestions?

Steamboat answered 23/7, 2010 at 19:12 Comment(1)
Perhaps writing one? With php.net/manual/de/book.zip.php and en.wikipedia.org/wiki/EPub you should get results quite fast. It's just little more than a bunch of zipped HTML files.Caldarium
Z
25

You might want to have a look at ePubExport project or get an idea from its source code.

ePubExport is a Mediawiki extension for export wiki pages in epub format for offline reading in supported electronic readers or tablets.

Also have a look at award-winning class EPub

This class can be used to create create an ebook in EPUB format for Apple iPad and other ebook readers.

It can set the ebook details like the author, publisher, comments, etc., as well the ebook chapter data.

The class builds an archive with all the ebook information and serves the ebook archive for download or returns it as a string.

More Resources/Libraries:

Zipnick answered 26/7, 2010 at 8:24 Comment(0)
V
4

Epub is just an archive, like zip or tar. If you want to create an epub file with php from scratch, you have to create separate html-files and a few xml-files with the correct information. Then you should combine them in an archive, it's actually just a zip-archive. It's a little bit work, but it's not very difficult to do with php.

Creating a zip: http://davidwalsh.name/create-zip-php

For XML, it's the simplest to create just the tags you need, it's simple to build it with the correct output.

So:

1) Create html and xml-files and save them temporarily on your server.

2) Create a zip archive with the correct files on your server.

3) Let the user download the archive with the extension .epub.

Good luck!

Vermiform answered 24/2, 2013 at 15:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.