fetch Cover Image from epub in ios

2019-08-11 02:12发布

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.

标签: ios epub cover
1条回答
一夜七次
2楼-- · 2019-08-11 03:10

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.

查看更多
登录 后发表回答