fetch Cover Image from epub in ios

流过昼夜 提交于 2019-12-13 19:22:32

问题


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.

  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.



来源:https://stackoverflow.com/questions/34545838/fetch-cover-image-from-epub-in-ios

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!