<commit_before>---
dropdown: Tutorials
pos: 3.1
layout: default
title: Creating an EPUB using existing HTML content
---

<h1>Creating an EPUB using existing HTML content</h1>
<div>
    <h2>Introduction</h2>
    <p>In this tutortial 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.
    </p>
</div>

<div>
    <h2>Requirements</h2>
    <ul>
    	<li><a href="http://www.bbc.com/news/world-europe-34634214">Article 1</a></li>
    	<li><a href="http://www.bbc.com/sport/0/formula1/34633569">Article 2</a></li>
    	<li><a href="http://www.bbc.com/culture/story/20151014-bond-women-sexy-or-just-sexist">Article 3</a></li>
    	<li>or download the articles in a single zip <a href="https://drive.google.com/file/d/0B-qMtkPK-unYbGxXN2dpT1NxaE0/view?usp=sharing">here</a></li>
    	<li><a href="http://api-dev.freme-project.eu/doc/api-doc/full.html">e-Publishing Documentation</a></li>
    </ul>
</div>

<div>
	<h2>Step 1 - Collect the needed files</h2>
	<p>
        Collect and zip all the aformentioned articles, and their necessary files, or download the aforementioned 'articles.zip'.
        The structure of the zip will be unchanged in the resulting EPUB file.
	</p>
</div>

<div>
	<h2>Step 2 - Metadata</h2>
	<p>
        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 befound <a href="api-dev.freme-project.eu/doc/api-doc/full.html">here</a>.
        The metadata is represented using JSON, as can be seen in the following example.

        <!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%">1
2
3
4
5
6
7
8</pre></td><td><pre style="margin: 0; line-height: 125%">{
  <span style="color: #000080; font-weight: bold">&quot;titles&quot;</span>:[<span style="color: #0000FF">&quot;Articles by BBC News&quot;</span>],
  <span style="color: #000080; font-weight: bold">&quot;creators&quot;</span>:[{<span style="color: #000080; font-weight: bold">&quot;firstName&quot;</span>: <span style="color: #0000FF">&quot;Joske&quot;</span>,<span style="color: #000080; font-weight: bold">&quot;lastName&quot;</span>: <span style="color: #0000FF">&quot;Vermeulen&quot;</span>,<span style="color: #000080; font-weight: bold">&quot;roles&quot;</span>:[<span style="color: #0000FF">&quot;author&quot;</span>]}],
  <span style="color: #000080; font-weight: bold">&quot;subjects&quot;</span>:[<span style="color: #0000FF">&quot;news&quot;</span>,<span style="color: #0000FF">&quot;world&quot;</span>],
  <span style="color: #000080; font-weight: bold">&quot;language&quot;</span>:<span style="color: #0000FF">&quot;en&quot;</span>,
  <span style="color: #000080; font-weight: bold">&quot;identifier&quot;</span>:{<span style="color: #000080; font-weight: bold">&quot;value&quot;</span>:<span style="color: #0000FF">&quot;urn:1235-568-78910&quot;</span>},
  <span style="color: #000080; font-weight: bold">&quot;tableOfContents&quot;</span>:[{<span style="color: #000080; font-weight: bold">&quot;title&quot;</span>:<span style="color: #0000FF">&quot;Migrant crisis: Thousands of new reception places agreed&quot;</span>,<span style="color: #000080; font-weight: bold">&quot;resource&quot;</span>:<span style="color: #0000FF">&quot;article_1.html&quot;</span>},{<span style="color: #000080; font-weight: bold">&quot;title&quot;</span>:<span style="color: #0000FF">&quot;<NAME> wins his third F1 World Championship&quot;</span>,<span style="color: #000080; font-weight: bold">&quot;resource&quot;</span>:<span style="color: #0000FF">&quot;article_2.html&quot;</span>},{<span style="color: #000080; font-weight: bold">&quot;title&quot;</span>:<span style="color: #0000FF">&quot;Are Bond girls sexist?&quot;</span>,<span style="color: #000080; font-weight: bold">&quot;resource&quot;</span>:<span style="color: #0000FF">&quot;article_3.html&quot;</span>}]
}
</pre></td></tr></table></div>


    </p>
</div>

<div>
	<h2>Step 3 - Call FREME e-service</h2>
	<p>
        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.

        <!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%">curl --form <span style="color: #0000FF">&quot;htmlZip=@articles.zip&quot;</span> --form metadata=<span style="color: #0000FF">&#39;{&quot;titles&quot;:[&quot;Articles by BBC News&quot;],&quot;creators&quot;:[{&quot;firstName&quot;: &quot;Joske&quot;,&quot;lastName&quot;: &quot;Vermeulen&quot;,&quot;roles&quot;:[&quot;author&quot;]}],&quot;subjects&quot;:[&quot;news&quot;,&quot;world&quot;],&quot;language&quot;:&quot;en&quot;,&quot;identifier&quot;:{&quot;value&quot;:&quot;urn:1235-568-78910&quot;},&quot;tableOfContents&quot;:[{&quot;title&quot;:&quot;Migrant crisis: Thousands of new reception places agreed&quot;,&quot;resource&quot;:&quot;article_1.html&quot;},{&quot;title&quot;:&quot;Lewis Hamilton wins his third F1 World Championship&quot;,&quot;resource&quot;:&quot;article_2.html&quot;},{&quot;title&quot;:&quot;Are Bond girls sexist?&quot;,&quot;resource&quot;:&quot;article_3.html&quot;}]}&#39;</span> http://api-dev.freme-project.eu/current/e-publishing/html
</pre></div>



        The result, called test.epub, will be saved in your home directory. You now have an e-book in the EPUB format, created using existing HTML content.
	</p>
</div>

</div><commit_msg>added result epub<commit_after>---
dropdown: Tutorials
pos: 3.1
layout: default
title: Creating an EPUB using existing HTML content
---

<h1>Creating an EPUB using existing HTML content</h1>
<div>
    <h2>Introduction</h2>
    <p>In this tutortial 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.
    </p>
</div>

<div>
    <h2>Requirements</h2>
    <ul>
    	<li><a href="http://www.bbc.com/news/world-europe-34634214">Article 1</a></li>
    	<li><a href="http://www.bbc.com/sport/0/formula1/34633569">Article 2</a></li>
    	<li><a href="http://www.bbc.com/culture/story/20151014-bond-women-sexy-or-just-sexist">Article 3</a></li>
    	<li>or download the articles in a single zip <a href="https://drive.google.com/file/d/0B-qMtkPK-unYbGxXN2dpT1NxaE0/view?usp=sharing">here</a></li>
    	<li><a href="http://api-dev.freme-project.eu/doc/api-doc/full.html">e-Publishing Documentation</a></li>
    </ul>
</div>

<div>
	<h2>Step 1 - Collect the needed files</h2>
	<p>
        Collect and zip all the aformentioned articles, and their necessary files, or download the aforementioned 'articles.zip'.
        The structure of the zip will be unchanged in the resulting EPUB file.
	</p>
</div>

<div>
	<h2>Step 2 - Metadata</h2>
	<p>
        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 befound <a href="api-dev.freme-project.eu/doc/api-doc/full.html">here</a>.
        The metadata is represented using JSON, as can be seen in the following example.

        <!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%">1
2
3
4
5
6
7
8</pre></td><td><pre style="margin: 0; line-height: 125%">{
  <span style="color: #000080; font-weight: bold">&quot;titles&quot;</span>:[<span style="color: #0000FF">&quot;Articles by BBC News&quot;</span>],
  <span style="color: #000080; font-weight: bold">&quot;creators&quot;</span>:[{<span style="color: #000080; font-weight: bold">&quot;firstName&quot;</span>: <span style="color: #0000FF">&quot;Joske&quot;</span>,<span style="color: #000080; font-weight: bold">&quot;lastName&quot;</span>: <span style="color: #0000FF">&quot;Vermeulen&quot;</span>,<span style="color: #000080; font-weight: bold">&quot;roles&quot;</span>:[<span style="color: #0000FF">&quot;author&quot;</span>]}],
  <span style="color: #000080; font-weight: bold">&quot;subjects&quot;</span>:[<span style="color: #0000FF">&quot;news&quot;</span>,<span style="color: #0000FF">&quot;world&quot;</span>],
  <span style="color: #000080; font-weight: bold">&quot;language&quot;</span>:<span style="color: #0000FF">&quot;en&quot;</span>,
  <span style="color: #000080; font-weight: bold">&quot;identifier&quot;</span>:{<span style="color: #000080; font-weight: bold">&quot;value&quot;</span>:<span style="color: #0000FF">&quot;urn:1235-568-78910&quot;</span>},
  <span style="color: #000080; font-weight: bold">&quot;tableOfContents&quot;</span>:[{<span style="color: #000080; font-weight: bold">&quot;title&quot;</span>:<span style="color: #0000FF">&quot;Migrant crisis: Thousands of new reception places agreed&quot;</span>,<span style="color: #000080; font-weight: bold">&quot;resource&quot;</span>:<span style="color: #0000FF">&quot;article_1.html&quot;</span>},{<span style="color: #000080; font-weight: bold">&quot;title&quot;</span>:<span style="color: #0000FF">&quot;<NAME> wins his third F1 World Championship&quot;</span>,<span style="color: #000080; font-weight: bold">&quot;resource&quot;</span>:<span style="color: #0000FF">&quot;article_2.html&quot;</span>},{<span style="color: #000080; font-weight: bold">&quot;title&quot;</span>:<span style="color: #0000FF">&quot;Are Bond girls sexist?&quot;</span>,<span style="color: #000080; font-weight: bold">&quot;resource&quot;</span>:<span style="color: #0000FF">&quot;article_3.html&quot;</span>}]
}
</pre></td></tr></table></div>


    </p>
</div>

<div>
	<h2>Step 3 - Call FREME e-service</h2>
	<p>
        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.

        <!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%">curl --form <span style="color: #0000FF">&quot;htmlZip=@articles.zip&quot;</span> --form metadata=<span style="color: #0000FF">&#39;{&quot;titles&quot;:[&quot;Articles by BBC News&quot;],&quot;creators&quot;:[{&quot;firstName&quot;: &quot;Joske&quot;,&quot;lastName&quot;: &quot;Vermeulen&quot;,&quot;roles&quot;:[&quot;author&quot;]}],&quot;subjects&quot;:[&quot;news&quot;,&quot;world&quot;],&quot;language&quot;:&quot;en&quot;,&quot;identifier&quot;:{&quot;value&quot;:&quot;urn:1235-568-78910&quot;},&quot;tableOfContents&quot;:[{&quot;title&quot;:&quot;Migrant crisis: Thousands of new reception places agreed&quot;,&quot;resource&quot;:&quot;article_1.html&quot;},{&quot;title&quot;:&quot;<NAME> wins his third F1 World Championship&quot;,&quot;resource&quot;:&quot;article_2.html&quot;},{&quot;title&quot;:&quot;Are Bond girls sexist?&quot;,&quot;resource&quot;:&quot;article_3.html&quot;}]}&#39;</span> http://api-dev.freme-project.eu/current/e-publishing/html
</pre></div>


        You now have an e-book in the EPUB format, created using existing HTML content. The result can also be downloaded <a href="https://drive.google.com/open?id=0B-qMtkPK-unYZmtORFFoMENTaVk">here</a>.
	</p>
</div>

</div>
{'fraction_non_alphanumeric': 0.19708273954229188, 'fraction_numerical': 0.046692933188029175, 'mean_word_length': 5.923969820081254, 'pattern_counts': {'":': 0, '<': 286, '<?xml version=': 0, '>': 286, 'https://': 3, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1863823', 'n_tokens_mistral': 4537, 'n_tokens_neox': 4117, 'n_words': 911}