How to create an ePub file with HTML and XML from scratch

Who I am
Catherine Le Nevez
@catherinelenevez
Author and references

Although this is not the only format in which it is possible acquire one of these files, since the most popular is PDF, it turns out to be the most recommended and used due to its characteristics of improving its readability.

That is why, from a technological point of view, the ways have been innovated so that various extensions can be converted to ePUB, and thus comfortably enjoy the book.

For those who wish to create ePUB files, they should know that one of the methods of obtaining it is tramite HTML and XML. Therefore, it's your lucky day if you know this programming language.



If not, you shouldn't even worry, because in this article we will explain how to create this type of extension for e-books from scratch.

Start creating your ePUB book by writing via HTML

Although their main use is for programmatic purposes, HTML files are nothing more than sheets di text, designed for aesthetic purposes when viewed in a browser; also, the transcription of this language can be done by Word and thus get a conversion.

Then proceed to write your book in its entirety, or divided into chapters, using the text editor, and then form the respective style sheets in number of two: the first dedicated to the pages, and the other to the style of the entire book generally.

Then, open a new document in your editor, and type in the "application / ePUB + zip" sheet, then save as "mimetype" without any extension.

By giving them whatever name you want, and with the appropriate extension, save all files within the same folder on your computer.


Design the first look at your book

Both the cover and the frontispiece will be the main attraction of readers, including the synapse of your book, so it's very important to assign both aspects as appropriately as possible.


For the cover, you need to store an image whose weight is not more than 64 kB and has a "JPG" format. This must be legible enough not to cause visual difficulties for readers.

The title page, on the other hand, must have its own file with the "XHTML" extension, which can contain an image or simply text, depending on the publisher's tastes.

Create the respective XML files of your ePUB

Each one is designed within the text editor you are using, they are the ones that will assign meaning and link to the HTML content that makes up your ePUB extension file.

The first of all will be the index, designated in any way, but with the extension "NCX". In your content, you need to generate a link to each of the HTML files that are inside the folder.

The second is a file called " container.xml «, Which is a container you need to keep in a subdirectory, in the book folder.


Finally, a file will be generated with the name and extension " content.opf ”, Which will have the task of storing information about the author, the genre of the book and other metadata.

Compress the book directory

Using any program, such as WinRAR, select the book folder to compress it using the software, with the only difference that instead of acquiring the "ZIP" extension, you have to change it to "ePUB".


Once the process is done and the reading and viewing have been successfully tested, you can connect it to the internet so that anyone interested can download and enjoy the content.

Create an EPUB file with HTML and XML from scratch  it's not that simple, but with hours of effort and dedication, you'll generate content that the community will enjoy.

TagsTutorial Internet report this ad
Audio Video How to create an ePub file with HTML and XML from scratch
add a comment of How to create an ePub file with HTML and XML from scratch
Comment sent successfully! We will review it in the next few hours.