Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

franium

macrumors member
Original poster
Nov 18, 2010
34
0
Hi all,
I'm trying to create a document (i.e. .doc,.html) with embedded images with objective-c.
The images are stored locally on the iPhone.
For example, I've created an html using img tag and the file uri scheme. Then I saved the html code on a .doc file. But the images are not displayed.
The same thing happens if I save the html code as an .html file.
Code:
[body appendString:@"<img src='"];
[body appendFormat:@"file:/%@", absolutePath];
[body appendString:@"' />"];
where absolutePath is the path of the image on the device (I printed it and it's right).
Any suggestion?
Thank you in advance,
Fran
 
Post the pathname output that makes you believe it's right.

Look up the NSString class reference doc, and look at the methods for working with percent escapes.

Look up the NSURL class reference doc, and look at the methods for making a file URL from a path. Cobbling one together like your current code is fraught with perils.

Where are you writing the HTML and the image files? What are you viewing them with? Does the app you're viewing with have permission to access where the files are stored?


Then I saved the html code on a .doc file.
This doesn't make sense. HTML is not the format of a .doc file. Please explain exactly what was written to the .doc file, and how the data was generated.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.