eBook Creation – Automated through PHP

The eBook is becoming a de-facto standard for Book reading which is compatible in most of the smart phone and tablets.

So, what is an eBook.  The Wiki says :

An electronic book (also e-book, ebook, electronic book, digital book) is a book-length publication in digital form, consisting of text, images, or both, and produced on, published through, and readable on computers or other electronic devices.

The file format of eBook is just a compressed file with an extension .epub. The contents of this file contains the XML and Html files which is used to

identify the chapters and paragraphs in the Book. This can also contain images and other resources

There are lot of tools in the market to convert your existing pdf,html ,doc files to a standard ePub format. Calibre is one of the best tools which i have been using for the few years to convert my PDF files to eBook.

Check it out http://calibre-ebook.com/

Calibre also provides command line tools through which you can automate your epub conversion through some programming language like PHP, .Net etc.

Here the Sample PHP code to accomplish this

[sourcecode language=”css”]

<strong></strong>$actualFile is the source file which you want to convert

$actualEpubFile is the destination file where you want to save the output

$options is the various filters provided by calibre for conversion.


$options.=’ –title "’.$title.’"’;
$options.=’ –authors "Author Name"  ‘;
$options.=’ –book-producer "Brahma Kumaris"  ‘;
$options.=’ –tags "Murli"  ‘;
$options.=’ –pubdate "’.$current_date.’"  ‘;

shell_exec(‘ebook-convert "’.$actualFile.’" "’.$actualEpubFile.’" ‘.$options);


[sourcecode language=”css”][/sourcecode]


Technical Geek - Gadget Enthusiast - Loves Programming C#,PHP & IOS - Blogger About

More Posts - Website

Follow Me:
TwitterGoogle Plus