Mobileread
Google Play Books and a CSS-specific error
#1  413Michele 01-30-2021, 10:50 AM
Hello!

I'm writing this post to share something I discovered and hopefully understand styles a bit more than before.

I have a calibre collection that from time to time I manually sync to Google Play Books to read on the go; yesterday I tried to add a new (perfectly working in calibre) EPUB3 file to Play Books, only to get a generic "Upload failed" error.

This without any debug information, but hey, it's Google...

I read the help page here and I checked my file with epubcheck, which gave me this error:

Code
ERROR(RSC-005): ./filename.epub/OEBPS/Text/cover.xhtml(22,58): Error while parsing file: value of attribute "height" is invalid; must be an integer
This was related to this line in the cover.xhtml file in the book, specifically to this line:

Code
<img alt="" height="100%" src="../Images/cover.jpg"/>
Now, I don't really know HTML and CSS apart from the basics, so I found that another EPUB I had used this construction, which seemed pretty identical to me in its effects:

Code
<img src="images/cover.jpg" style="height: 100%;"/>
So I took that line, put it in place of the first with the calibre Editor and uploaded the file.

Ta-da! Google accepts the file without any problem.

I've written this for two reasons:


What is wrong with the first way of using the height tag? I have at least a few books that use it, with no problems from the calibre viewer and Adobe Digital Editions. If somebody could explain it to me it'd be very helpful
Reply 

#2  Jellby 01-30-2021, 01:14 PM
<img height=...> is HTML, <img style="height:..."> is CSS (I mean the height part is CSS).

In HTML height is a number, in pixels, don't use it. In CSS height can have many units.
Reply 

#3  413Michele 01-30-2021, 01:30 PM
Quote Jellby
<img height=...> is HTML, <img style="height:..."> is CSS (I mean the height part is CSS).

In HTML height is a number, in pixels, don't use it. In CSS height can have many units.
Understood, thanks

Thinking back I think I caused the problem by updating from EPUB2 to EPUB3 with calibre, it left behind some tagging problems.

Later I dug some more in my files and I found similar "update caused" problems like in table borders (e.g. a table can't have the HTML tag border=0 anymore) and in the alt="" inside an <svg><image> tag, that was considered wrong in EPUB3 but not in EPUB2.

I resolved them manually, but I wonder if I should point them out in the calibre bug tracker, as their origin is probably the book editor. There are problems only with strict interpreters like Google Play Books though, so it's not very important
Reply 

#4  Quoth 01-30-2021, 06:12 PM
Also use a real Android App, not Google Playbooks, which is tied to the Playstore and requires the Google Framework. It's not a standalone Android App.
Lithium is far better.
I only use Playbooks for books FROM Google.
Reply 

#5  413Michele 01-31-2021, 01:56 PM
Quote Quoth
Also use a real Android App, not Google Playbooks, which is tied to the Playstore and requires the Google Framework. It's not a standalone Android App.
Lithium is far better.
I only use Playbooks for books FROM Google.
The thing is, I really like having synced books and reading point that Play Books offers, even if it means not having advanced options. I quite like their font, Literata, so it's a nice solution for me. I looked up Lithium though and I like it so thank you for the info, I'll give it a try
Reply 

Today's Posts | Search this Thread | Login | Register