[Okular-devel] Are CSS files in OEBPS folder of ePub ignored at all by Okular?

Albert Astals Cid aacid at kde.org
Sat Dec 8 14:22:15 UTC 2012


El Diumenge, 2 de desembre de 2012, a les 12:38:00, insight.am at libero.it va 
escriure:
> Hello,
> I performed some tests on ePub format with Okular and it seems that the css
> files inside OEBPS folder are ignored, that is, they are not loaded.
> I do not know if it is a bug or if the ePub generator lacks the
> functionality (although I was not able to find the code for that in Okular
> or libepub) so I do not want to bother anyone, I am just informing you.

Well, if those should be readed it is a bug. Please open a bug in bugs.kde.org 
and attach a file that has such a problem so we can keep track of it.

Cheers,
  Albert

> I unzipped an ePub file, edited the css file with strange rules (for example
> background:green) and recompressed it, but Okular ignores the rules, while
> it obeys them if they are in the source code:
> mTextDocument->setDefaultStyleSheet("div {background: green;}");
> (converter.cpp)
> When an ePub is unzipped and an html section is opened with a browser, the
> css is loaded because the browser is able to access the folder, as happens
> for images. When an html file is extracted from the zip (epub) the css is
> not automatically loaded because the application should mount the zip like
> fusezip does, but I do not even know if QTextDocument would act like a
> browser; however, I think Okular just extracts the resources from the zip.
> I see that images are loaded as resources so css files can be loaded too,
> merged, and passed to setDefaultStyleSheet(). Warning: this makes sense if
> css files are intended to be the same for all sections (if I am not wrong
> nothing prevents some sections to have different css files, that could be
> conflicting if merged). However, I think usually there is one css file only
> or, when more, they are intended to be global.
> A reset css file on the top of them (like Eric Meyer's one or similar) 
> could be a good idea too. And then also other smart css rules could be
> added to obtain the best results in pagination, although the max-width and
> max-height rules I tested to avoid image overflowing seem not to be working
> (but other css rules do have effect, like  background:green).
> I think css is very important because ePubs can yield poor renderings or
> strange results if css is ignored and it is what I experienced with some
> ebooks of mine with Okular.
> Best Regards
> Angelo
> 
> _______________________________________________
> Okular-devel mailing list
> Okular-devel at kde.org
> https://mail.kde.org/mailman/listinfo/okular-devel


More information about the Okular-devel mailing list