victorsoares96 / epubjs-react-native

ePub.js Reader for React Native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing images in Epub3 and changeFontFamily

paulNIP opened this issue · comments

Hi need some help can't seem to load images in Epub 3 it only loads Epub2 and the how to use changeFontFamily function implementation is not clear not example exists

You can use it this way:

import * as React from 'react';
import {
  SafeAreaView,
  text,
  TouchableOpacity,
  useWindowDimensions,
  view,
} from 'react-native';
import { Reader, ReaderProvider, useReader } from '@epubjs-react-native/core';
import { useFileSystem } from '@epubjs-react-native/file-system';
import { styles } from './styles';

function Inner() {
  const { width, height } = useWindowDimensions();
  const { changeFontFamily, changeFontSize } = useReader();
  return (
    <SafeAreaView style={styles.container}>
      <View style={styles.options}>
        <TouchableOpacity onPress={() => changeFontFamily('cursive')}>
          <Text>Change FontFamily</Text>
        </TouchableOpacity>

        <TouchableOpacity onPress={() => changeFontSize('10px')}>
          <Text>FontSize small</Text>
        </TouchableOpacity>

        <TouchableOpacity onPress={() => changeFontSize('36px')}>
          <Text>FontSize big</Text>
        </TouchableOpacity>
      </View>

      <Reader
        src="https://s3.amazonaws.com/moby-dick/OPS/package.opf"
        width={width}
        height={height * 0.7}
        fileSystem={useFileSystem}
      />
    </SafeAreaView>
  );
}

export function CustomFont() {
  return (
    <ReaderProvider>
      <Inner />
    </ReaderProvider>
  );
}

The changeFontFamily method only accepts webSafe fonts (https://www.w3schools.com/cssref/css_websafe_fonts.php)

Thanks you so much for the above reply now having one issue with the images in epub3 , it displays well with other pubs but epub3 images are not shown

Can you provide the epub?

Thanks this the Epub
https://rhapsodyofrealities.b-cdn.net/app/books/epub2024-april.epub
most of our epubs are in this format epub3

hello @paulNIP i'll take a look

hello @paulNIP i'll take a look

Hi Hope you are doing well is there any feedback on that epub rendering images

I had problems with this issue hope can work on it in the near future but images not displaying was resulting from the epub size being big . a quick solution would be to compress or reduce your epub size and your good to Go

Done

@paulNIP I'm currently working on other things that keep me from focusing on this, so I'll work on your request as soon as possible!