Hi,

I just wrote some code to export an attributed string to a HTML file wrapper, with images within a folder. It works fine, except the image URLs in the HTML are invalid; they are just "file:///" and the image name. Omitting that prefix would make them valid relative URLs. How can I get them to be relative URLs, other than editing the HTML and doing it after creation? I tried specifying a NSBaseURLDocumentOption attribute, but that doesn't seem to be used when saving.

I couldn't find an answer to this, though I found someone else asking the same question just a few days ago (without any response so far):

<http://www.cocoabuilder.com/archive/message/cocoa/2009/2/16/230320>

My code is simply (where "output" is an attributed string and "path" is the destination path):


NSDictionary *attributes = [NSDictionary dictionaryWithObject:NSHTMLTextDocumentType forKey:NSDocumentTypeDocumentAttribute]; NSFileWrapper *wrapper = [output fileWrapperFromRange:NSMakeRange(0, [output length]) documentAttributes:attributes error:nil];

return (wrapper && [wrapper writeToFile:path atomically:NO updateFilenames:YES]);

--

David Sinclair, Dejal Systems, LLC - d...@dejal.com
Dejal blog - http://www.dejal.com/blog/
Cocoa code - http://www.dejal.com/developer/
Twitter - http://twitter.com/dejal/






_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to