fetch Cover Image from epub in ios
Asked Answered
L

1

1

I want to display Book Cover Image of epub file in my Reading table. In my iOS application I have added "Open In" support for epub files. So when i navigate to my book reading app I want to show book's cover image in shelf first and then want to load that book. Please help me to fetch Cover Image from epub book in ios app.

Liegeman answered 31/12, 2015 at 11:30 Comment(0)
P
5

You will have to unzip the ePub and parse the metadata.

  1. Parse META-INF/container.xml and find the .OPF file path.
  2. The .OPF file contains all that you need, a tag meta with name cover that refers to a tag item, this is the image cover.

  3. You can copy this image to somewhere and delete the unzipped files.

PS: I am the creator of FolioReaderKit an ePub Reader and Parser written in Swift 2, this is where I get the book cover FREpubParser.swift. If you don't want to deal XML you can read the ePubs using it, it will also parse the metadata and exposes for you.

Pilau answered 8/1, 2016 at 20:3 Comment(6)
Thanks you ... I have followed your steps and it worked for me... Have you worked on epub3 reader?Liegeman
I'm starting the implementation of epub3 on FolioReaderKit.Pilau
@Kavya FYI I have implemented ePub 3 support.Pilau
Yeah, free and Open Source :)Pilau
Have you created any SDK for audio epub books?Liegeman
is this a rule that all epubs must follow? I see the following in an example <meta name="cover" content="cover-image" /> will there always be this format?... i.e. there will always be an attribute content which will refer to the id in the manifest?Cutup

© 2022 - 2024 — McMap. All rights reserved.