Create a document with embedded images

Discussion in 'iOS Programming' started by franium, Jun 13, 2011.

  1. franium macrumors member

    Joined:
    Nov 18, 2010
    #1
    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
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    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?


    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.
     

Share This Page