Creating an EPUB using existing HTML content

Introduction

In this tutorial you will be shown how you can create an e-book in the EPUB format using the FREME service e-Publishing. We will use three news articles from the BCC website, as HTML content sources.

Requirements

Step 1 - Collect the needed files

Collect and zip all the aforementioned articles, and their necessary files, or download the aforementioned 'articles.zip'. The structure of the zip will be unchanged in the resulting EPUB file.

Step 2 - Metadata

Before we bundle the articles in a single EPUB file using the e-service 'e-Publishing/html', we need to provide the needed metadata about the e-book. Here, we will only use a number of the metadata parameters. However, a full list of parameters can be found here. Additionally, because we do not specify the version (2 or 3) of the EPUB specification to be used, the default version will be used, which is 3. The metadata is represented using JSON, as can be seen in the following example.

1
2
3
4
5
6
7
8
{
  "titles":["Articles from Wikinews"],
  "creators":[{"firstName": "Joske","lastName": "Vermeulen","roles":["author"]}],
  "subjects":["news","world"],
  "language":"en",
  "identifier":{"value":"urn:1235-568-78910"},
  "tableOfContents":[{"title":"Romanian Prime Minister resigns after nightclub fire","resource":"article_1.html"},{"title":"Magnitude 7.5 earthquake hits Afghanistan","resource":"article_2.html"},{"title":"NASA releases complete image of Pluto her crescent","resource":"article_3.html"}]
}

Step 3 - Call FREME e-service

Once we have both the needed files and the metadata, we are ready to call the FREME e-service. You can easily do this using the Terminal, by executing the following command.

curl --form "htmlZip=@articles.zip" --form metadata='{"titles":["Articles from Wikinews"],"creators":[{"firstName": "Joske","lastName": "Vermeulen","roles":["author"]}],"subjects":["news","world"],"language":"en","identifier":{"value":"urn:1235-568-78910"},"tableOfContents":[{"title":"Romanian Prime Minister resigns after nightclub fire","resource":"article_1.html"},{"title":"Magnitude 7.5 earthquake hits Afghanistan","resource":"article_2.html"},{"title":"NASA releases complete image of Pluto his crescent","resource":"article_3.html"}]}'
https://api.freme-project.eu/current/e-publishing/html
You now have an e-book in the EPUB format, created using existing HTML content. The result can also be downloaded here.