Question

I am generating epub book file, and im stuck with a problem. It doesn't read my cover. Here's the cover.xhtml Am I doing something wrong? IMB documentation over the epub creation tells that the only one I need is cover.html file and a images folder with a image in my /OPS folder.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Cover</title>
<style type="text/css"> img { max-width: 100%; } </style>
</head>
<body>
<div id="cover-image">
<img src="/images/cover.jpg" alt="Title"/>
</div>
</body>
</html>
Was it helpful?

Solution

The problem is as likely to be in your package file as it is in this file. However, there is one definite problem with this xhtml file. The URL to the image itself needs to be relative. All paths/urls in an EPUB are relative. Assuming that your images are in subdirectory of the directory containing the xhtml files, then you need to have a img element like:

<img src="images/cover.jpg alt="Title"/>

EDIT (Extraneon added comment by author to answer)

It's always worth using the epubcheck utility when you have problems. I added the xhtml you used to one of my EPUBs and epubcheck reported the problem,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top