问题
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.
回答1:
You will have to unzip the ePub and parse the metadata.
- Parse
META-INF/container.xml
and find the .OPF file path. The .OPF file contains all that you need, a tag
meta
with namecover
that refers to a tagitem
, this is the image cover.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.
来源:https://stackoverflow.com/questions/34545838/fetch-cover-image-from-epub-in-ios