![]() Work out what the full path is (hint: it's wherever you unzipped the zip file to in (Step 3), plus the base NSDictionary of the OPF file in (Step 6). this is the the file of the first chapter to show the user.Look up that id in the NSDictionary and you'll get an href. It has an idref attribute which corresponds to one of the ids in (Step 7a). Store these in an NSDictionary where the key is the id and the object is the href. Each in the element has an id and an href.Step 7: Now you need to know what the first chapter of the book is. Step 5: In this XML, find the first " rootfile" with media-type application/oebps-package+xml. If this file directory doesn't exist means, your EPUB file is invalid. Step 4: Parse the XML file from directory META-INF/container.xml. ![]() Step 3: Unzip EPUB file to a subdirectory in your app's documents folder. ![]() Step 2: Download an EPUB file and import into your project If you implement your own URL protocol handler, you need to make sure the protocol handler returns the correct xml content type for xhtml, namely: xhtml extension when using file:/// urls. NOTE: For the UIWebView to display the content correctly, you have to ensure that the file has a. This is the work that iBooks and other apps do for you. That will display the content just fine, but the "hard" part is moving between the documents (which usually represent a whole chapter). If you want to ensure that the documents don't hit the network you'll need to implement a custom NSURLProtocol and serve the bytes for the files yourself as file:/// allows cross domain access. Load the xhtml documents into a UIWebView using a file:/// URL to the unzipped document.Read the manifest file and metadata file to find the xhtml documents to display. ![]() As the previous article points out, there is no API that given an ePub will just display it - you need to do some work:
0 Comments
Leave a Reply. |