0

I am doing following steps to display a html file in uiwebview.

1.unzip the .epub file, from that get html file content in a array

NSData *data=[NSData dataWithContentsOfFile:filepath];

[arrayDatacontent addObject:data];

after this process complete. Removed the unzip .epub file.

    2.

NSData *htmlString=(NSData *)[arrayDatacontent objectAtIndex:2];

NSString *imagePath =[[NSBundle mainBundle] resourcePath];

imagePath = [imagePath stringByReplacingOccurrencesOfString:@"/" withString:@"//"];

imagePath = [imagePath stringByReplacingOccurrencesOfString:@" " withString:@"%20"];

[webview4epub loadData:htmlString MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:[NSString stringWithFormat:@"file:/%@//",imagePath]]];

from this content text loaded in the webview. But there relative images is not shown.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Senthilkumar
  • 2,471
  • 4
  • 30
  • 50
  • Why do you expect a method designated for loading a string to load arbitrary binary data? –  Jul 18 '13 at 12:10
  • @H2CO3: sorry, i edit above, but same issue occur.. – Senthilkumar Jul 18 '13 at 12:15
  • Of course, because you made the very same mistake. Raw image data is **still** not HTML. –  Jul 18 '13 at 15:17
  • In the html img scr location image is available. I deleted only the html file images are there. Even though it will not link that particular image path. – Senthilkumar Jul 19 '13 at 05:09

0 Answers0