seblucas / cops

Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)
http://blog.slucas.fr/en/oss/calibre-opds-php-server
GNU General Public License v2.0
1.41k stars 227 forks source link

[New feature] Inline web reader? #367

Open C-Duv opened 6 years ago

C-Duv commented 6 years ago

Could COPS directly serve books' pages as text and/or images via the browser? With recent browsers being able to read PDF this is not an issue for PDF ebooks, but other formats are not supported by browsers and requires a separate reader software.

Each ebook's page would be a separate HTML document/page (with it's own HTTP URL). This would need COPS to handle book's conversion from original format (the one in Calibre's library: PDF, MOBI, EPUB, etc.) to plain text and images, and also generate HTML documents.

I guess mainly-text formats like MOBI/EPUB/... can easily be converted into text and that the ebooks graphics in this format are easily extractable. Text and image would be assembled in a HTML document For mainly-graphic formats like PDF/CBZ/... COPS should create an image for the requested ebook's page and serve it as-is in an HTML document.

With such feature COPS would then not only be a file server, but also a content/page server and any web browser would be an ebook reader. Obviously the reading would be on-line only: no ebook fragment would be stored on the device.

marioscube commented 6 years ago

If you want to read your epubs in a browser. then take a look at Ubooquity https://vaemendis.net/ubooquity/

seblucas commented 6 years ago

Could COPS directly serve books' pages as text and/or images via the browser? With recent browsers being able to read PDF this is not an issue for PDF ebooks, but other formats are > not supported by browsers and requires a separate reader software.

The answer is yes, for now I force every single file format served from COPS to be treated as an attachment so the browser propose to download it. I can make it optional (or smarter) to make use of the integrated PDF Reader (Chrome / Firefox) and Epub Reader (Edge) and even your favourite reader installed on your machine.

For now there an integrated Epub reader in COPS, I'm seriously thinking of removing it. I'm never using it, I never read on a browser : I have a e-ink reader for books and I'm still buying only hard copies for my comics (I'm not ready for e-comics / CBZ CBR).

I'm still thinking about it but that's my current state of mind.

horus68 commented 6 years ago

I also do not read on a browser but I use the browser when promoting the software and to show people the epub books directly on browser. Its just a simple "see this is the book in special format" or you can also have the old PDF file.

C-Duv commented 6 years ago

The answer is yes, for now I force every single file format served from COPS to be treated as an attachment so the browser propose to download it. I can make it optional (or smarter) to make use of the integrated PDF Reader (Chrome / Firefox) and Epub Reader (Edge) and even your favourite reader installed on your machine.

I rather get HTML with <img> than PDF file (whatever the render I use) because PDF format requires to download the full document. With HTML I can fluently read it page by page (see it as a "page streamer").

Thanks, marioscube, I'll look into Ubooquity...

rockonedege commented 6 years ago

I submitted a PR #374 to implement the feature by adding a button side by side. Admittedly, it's my first touch on PHP and a surely ugly hack. Feel free to improve both the idea and the code.

9Skrip commented 5 years ago

I would like a web pdf reader to.