How do you embed .epub in a web page?

Is there any viewer or plugin of any type that allows you to view a .pub document on a web page? A lot of installation programs for viewing emails appeared on the Google search engine, but I could not find anything to implement this format on a web page. Perhaps you people understand this?

+6
source share
2 answers

epub files are just HTML / XML and CSS, so you can easily open the epub container (this is a zip file) and then parse the XML internally using a language such as PHP.

This should not be too hard to do.

The format is as follows:

--ZIP Container-- mimetype META-INF/ container.xml OPS/ book.opf chapter1.xhtml ch1-pic.png css/ style.css myfont.otf 

Here is an example of the content you can find in chapter 1:

 <?xml version="1.0" encoding="UTF-8" ?> <!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" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> <title>Pride and Prejudice</title> <link rel="stylesheet" href="css/main.css" type="text/css" /> </head> <body> ... </body> </html> 
+5
source

I would suggest that in most cases this should be done using Javascript, using a library similar to one of How to read epub files using javascript

0
source

Source: https://habr.com/ru/post/897328/


All Articles