Comments (7)
That's interesting. Can you upload your epub file somewhere so I can take a look?
from epubreader.
@versfx Yes, of course. There are few books which I used. Unfortunately you should download it from google drive because github doesn't support epub extension in attachment. https://drive.google.com/drive/folders/0BwwwPXS7GsatY25xWVRxUmh6TWc?usp=sharing
from epubreader.
@versfx I found one interesting fact. I looked into few epub archives and found that a book cover image might situated into a different folder (for example OPS\images, OEBPS\images). Some archive doesn't have folder which contains any other images.
from epubreader.
EPUB specification does not define a way to describe covers, but the usual practice is to set it using <meta name="cover" />
tag in the OPF file (as a reference to the cover image file). In addition to that some books also provide an alternative XHTML version of the cover using <item id="cover" media-type="application/xhtml+xml" />
tag (in the manifest
section) and/or using <reference type="cover" />
tag (in the guide
section), however I haven't seen a book with XHTML cover which didn't have an image version of the cover.
In your case:
- Carroll_Lewis_-_Alice_Adventures_in_Wonderland.epub: has XHTML cover in the
reference
tag, but there is no image version of the cover specified; - Chehov_Anton_-_Rasskazy_1887.epub: also XHTML cover in the
reference
tag, no image version; - Conan_Doyle_Arthur_-_The_Lost_World.epub: has image version specified as
<meta content="item6" name="cover" />
, but there is no content element with ID = "item6" in the manifest section below; - the-doomed-city.epub and zhuk-v-myraveinike.epub: no specified covers.
Pocket Book reader probably takes XHTML versions or renders the first page of the book as a cover.
If you want to get an XHTML version of the cover from the guide
section (which again is very unusual for the most of epub files), you can do it like this:
EpubGuideReference coverPageReference = epubBook.Schema.Package.Guide.FirstOrDefault(reference => String.Compare(reference.Type, "cover", StringComparison.OrdinalIgnoreCase) == 0);
if (coverPageReference != null)
{
EpubTextContentFile coverPage;
if (epubBook.Content.Html.TryGetValue(coverPageReference.Href, out coverPage))
{
// coverPage.Content has XHTML version of the cover page
}
}
from epubreader.
@versfx What do you think it's a good idea to search a book's cover across the archive folder and then store it in a database (as array of bytes for example)? Unfortunately a lot of books will have incorrect a book's metadata. I think that change a book's metadata it's not a good idea. I develop the ePUB reader application based on Xamarin.Forms. A default user can't change metadata by itself. Do you have any other elegant ideas how to get a book's cover image. I know that I can display it by using cover.html, but I'm looking for a approach to display a book's preview at my home page. Also I want to say thanks for you informative answers.
from epubreader.
The problem is that you cannot distinguish cover image from other images in the book unless it is explicitly marked as a cover. Of course you can apply some heuristics by looking for an image that has "cover" in its name but this is not very robust solution. Another approach would be to show all the images (epubBook.Content.Images
) to the users and ask them to choose the cover.
from epubreader.
Please let me know if you have any other questions or comments.
from epubreader.
Related Issues (20)
- Analysis of e-books in Mobi format HOT 2
- Parse just an OPF File HOT 1
- Add support for BMP image files HOT 3
- How to pull specific text HOT 1
- Incorrect EPUB manifest: item with href = "Text/0001.xhtml" is not unique HOT 1
- How to write EPUB files? HOT 5
- Parse <nav> elements nested in other HTML elements in EPUB 3 navigation documents HOT 2
- Exception: 'Incorrect EPUB spine: item with IdRef = "cover" is missing in the manifest.'
- Drop support for .NET Framework and .NET Standard
- Consider switching from HtmlRenderer.WPF to WebView2 in the WPF demo app
- EPUB 3.3 support
- Expose the data parsed from the SMIL files as narration objects
- Update documentation for 3.3.0 release
- Handling Keys HOT 2
- EpubContentFileRef.ReadContentAsTextAsync() missing in v3.3.0 HOT 1
- Epub2NcxException/Epub3NavException exceptions are thrown when OPF and navigation files are located in different subdirectories HOT 7
- v3.3.1 Changes HOT 6
- Regression in v3.3.1 with parsing nav element HOT 4
- Configuration options to enable / disable all validation checks
- Unescape URLs in EPUB 2 NCX and EPUB 3 navigation documents
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from epubreader.