I'm trying to convert from RTF to HTML like so:

        NSAttributedString* rtfContent = [[NSAttributedString 
alloc]initWithRTF:rtfData documentAttributes:nil];
        NSData* htmlData = [rtfContent dataFromRange:NSMakeRange(0, 
rtfContent.length) 
documentAttributes:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType} 
error:nil];
        NSString* htmlString = [[NSString alloc]initWithData:htmlData 
encoding:NSUTF8StringEncoding];

It works - up to a point.  The point at which it fails is that the image links 
in the rtfData are missed out of the resultant htmlString:

RTF
{\*\htmltag84 <a href="mailto:king.k...@empirestate.com";>}\htmlrtf 
{\field{\*\fldinst{HYPERLINK 
"mailto:king.k...@empirestate.com"}}{\fldrslt\cf1\ul \htmlrtf0 
king.k...@empirestate.com\htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 
{\*\htmltag92 </a>}
{\*\htmltag244 <o:p>}
{\*\htmltag252 </o:p>}
{\*\htmltag92 </span>}\htmlrtf }\htmlrtf0 \htmlrtf\par}\htmlrtf0
\htmlrtf \par
\htmlrtf0 
{\*\htmltag72 </p>}
{\*\htmltag64 <p class=MsoNormal>}\htmlrtf {\htmlrtf0 
{\*\htmltag84 <span style='font-size:10.0pt;color:#1F497D'>}\htmlrtf {\htmlrtf0 
{\*\htmltag244 <o:p>}
{\*\htmltag84 &nbsp;}\htmlrtf \'a0\htmlrtf0 
{\*\htmltag252 </o:p>}
{\*\htmltag92 </span>}\htmlrtf }\htmlrtf0 \htmlrtf\par}\htmlrtf0
\htmlrtf \par
\htmlrtf0 
{\*\htmltag72 </p>}
{\*\htmltag64 <p class=MsoNormal>}\htmlrtf {\htmlrtf0 
{\*\htmltag84 <span style='color:#1F497D'>}\htmlrtf {\htmlrtf0 
{\*\htmltag84 <img border=0 width=224 height=51 id="_x0000_i1033" 
src="cid:image001.jpg@01CE8098.AD1C4B20" alt="LH_logo600r1idx">}\htmlrtf 
{\chbrdr\brdrsh LH_logo600r1idx}\htmlrtf0 

HTML
<p class="p3"><span class="s1"><a 
href="mailto:king.k...@empirestate.com";>king.k...@empirestate.com</a></span></p>
<p class="p2"><br></p>
<p class="p1"> </p>
<p class="p2"><br></p>
<p class="p1">LH_logo600r1idx</p>

Does anyone have any idea how I can ensure that the generated HTML is complete?

Thanks for any help you can provide!
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to