View Full Version : Embed EPUB in a webpage


silviolorusso
06-20-2011, 06:05 AM
Hello,

I was wondering if there's a way to embed EPUB visualization in a webpage. Like Scribd or Issuu.

Thanks!

DaleDe
06-20-2011, 12:28 PM
Hello,

I was wondering if there's a way to embed EPUB visualization in a webpage. Like Scribd or Issuu.

Thanks!

I would suggest you unzip it and place the contents in a folder, then reference the start from a link on a web page. The standard epub toc won't work but if you have an inline toc it should be fine. You need to preserve what folders you find in the epub exactly as they appear there.

Dale

JodyC
07-27-2014, 09:55 PM
I would suggest you unzip it and place the contents in a folder, then reference the start from a link on a web page. The standard epub toc won't work but if you have an inline toc it should be fine. You need to preserve what folders you find in the epub exactly as they appear there.

Dale

Hi, can you give more detail on how to reference the start from a link on web page?

Much appreciated
Jody

eschwartz
07-27-2014, 10:26 PM
I would suggest you unzip it and place the contents in a folder, then reference the start from a link on a web page. The standard epub toc won't work but if you have an inline toc it should be fine. You need to preserve what folders you find in the epub exactly as they appear there.

Dale

How do you suggest going from one file to the next? That info is contained only in the spine.

Should the reader keep referring back to the ToC? (Not a guaranteed solution anyway.)

DaleDe
07-28-2014, 01:32 AM
How do you suggest going from one file to the next? That info is contained only in the spine.

Should the reader keep referring back to the ToC? (Not a guaranteed solution anyway.)

At the bottom of the page you need to link to the next page and to the previous page using HTML links. Once you do the first one you can use it as a template for the other pages. It is also a good idea to place a link back to the TOC.

By the way, the is exactly what epub reader does automatically. ePub reader has its on forum on this web site.

Dale

DaleDe
07-28-2014, 01:36 AM
Hi, can you give more detail on how to reference the start from a link on web page?

Much appreciated
Jody

The links between the pages are straight forward html links such as
<a href="page1.html">Page 1</a>

where page1.html is replaced with the actual name of the first file. Place this line at the bottom of the file and/or up at the top.

Dale

eschwartz
07-28-2014, 07:18 AM
At the bottom of the page you need to link to the next page and to the previous page using HTML links. Once you do the first one you can use it as a template for the other pages. It is also a good idea to place a link back to the TOC.

By the way, the is exactly what epub reader does automatically. ePub reader has its on forum on this web site.

Dale

Which is of course more than simply unzipping to a folder.

I second the EPUBReader suggestion.

skreutzer
07-29-2014, 02:11 PM
I've just written a Java program which is supposed to do exactly that:

epub2html1 (https://github.com/skreutzer/automated_digital_publishing/tree/master/epub2html/epub2html1)

An EPUB2 file gets extracted to a standard local HTML file collection. An index.html isn't generated automatically yet, but such feature can be integrated easily. Some file references like embedded fonts (CSS @font-face) won't get recognized, I guess. Currently, I don't provide a binary executable download package for it, so you could either compile it for yourself, or I could prepare such a package on request.

eschwartz
07-29-2014, 03:08 PM
I've just written a Java program which is supposed to do exactly that:

epub2html1 (https://github.com/skreutzer/automated_digital_publishing/tree/master/epub2html/epub2html1)

An EPUB2 file gets extracted to a standard local HTML file collection. An index.html isn't generated automatically yet, but such feature can be integrated easily. Some file references like embedded fonts (CSS @font-face) won't get recognized, I guess. Currently, I don't provide a binary executable download package for it, so you could either compile it for yourself, or I could prepare such a package on request.

:thumbsup: That looks very interesting. If it doesn't already, perhaps it could do something like framing the files, kind of like the way Baen does it; example here: http://www.baenebooks.com/chapters/9781625791214/9781625791214.htm

skreutzer
07-29-2014, 03:21 PM
I've just noticed that the original post #1 is quite old and now the topic has changed to JodyC's question. epub2html1 shouldn't get involved into generating the links between the extracted pages (since its responsibility is to get rid of EPUB specifics by creating a plain HTML collection), but it could indeed write a XML file with information about what was extracted (basically keeping the NCX more or less). From there, either another tool could take this XML file and incorporate the links into every HTML file as well as generating an index.html from it (HTML TOC), HTML frames are an even easier solution, or a PHP script on a server could add the links on each request while echoing the HTML files (with or without support of the XML file). Depends on if the HTML files should be used as standalone files, or if they're supposed to live on a webserver. As I'm currently investigating ways to post HTML programmatically to WordPress, you would get this features too out of the box.