简体   繁体   English

如何在 React Native Expo 项目中渲染 epub 文件

[英]How to render epub file in React Native Expo project

Please, help.请帮忙。

I have a.epub file.我有一个 .epub 文件。 How can I render it in a React native expo project.如何在 React 本机 expo 项目中渲染它。 And if you know how to render an epub file with media overlay.如果您知道如何使用媒体覆盖呈现 epub 文件。

expo version: 43.0.2 react-native: 0.64.3 expo 版本:43.0.2 react-native:0.64.3

Any help is appreciated.任何帮助表示赞赏。

There's no ready-made solution for rendering ebup file in the Expo app. Expo 应用程序中没有现成的渲染ebup文件的解决方案。

There are many services that offer API to convert EPUB TO PDF.有许多服务提供 API 将 EPUB 转换为 PDF。

after converting to PDF, you can use react-native-pdf .This is native module linking.转换为 PDF 后,您可以使用react-native-pdf 。这是本地模块链接。 You will need to use an expo custom client which support adding your custom library.您将需要使用支持添加自定义库的 expo 自定义客户端。

An ePub is simply xhtmlX thus in theory the contents should be renderable in any browser when unpacked. ePub 就是简单的 xhtmlX,因此理论上内容在解压后应该可以在任何浏览器中呈现。

Unfortunatly ePub have not capitalised on that simplicity, by not insisting on a sidebar of contents like in a PDF, (one very simple step)不幸的是,ePub 没有利用这种简单性,没有坚持像 PDF 那样的内容侧边栏,(一个非常简单的步骤)

You can extract the pages/chapters and serve them by adding your own Iframe built from the ToC as sidebar for navigation.您可以提取页面/章节并通过添加您自己的从 ToC 构建的 Iframe 作为导航侧边栏来提供它们。

I don't have an example to hand on this device but chapter 2 of Homerus should look like this in the page body.我没有关于此设备的示例,但 Homerus 的第 2 章在页面正文中应该如下所示。

在此处输入图像描述

and here are the two files that either could have been easily adapted to a htmlx navbar这里有两个文件可以很容易地适应 htmlx 导航栏

在此处输入图像描述

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM