Closed MartinAmsinck closed 3 years ago
My bad - fixed with an upgrade to the newest version
Found the issue(again), It is an azure issue. There's GDI+ restrictions on Azure.
Any ideas for a workaround here?
I have same issue. Only a problem on Azure. As Martin mentions, Azure Web App's, and also Azure Functions, due to security restrictions, don't have access to the kernel GDI. So some functions in System.Drawing is not available.
The bold line contains the issue (RtfHtmlSettings.cs)
if (picture.Type is EmfBlip || picture.Type is WmMetafile)
{
using (var source = new MemoryStream(picture.Bytes))
using (var dest = new MemoryStream())
{
**var bmp = new System.Drawing.Bitmap(source);**
bmp.Save(dest, System.Drawing.Imaging.ImageFormat.Png);
return "data:image/png;base64," + Convert.ToBase64String(dest.ToArray());
}
}
The workaround is to pass in an RtfHtmlSettings
object where you provide your own ImageUriGetter
callback. In that callback, you can return whatever URL you want for any given picture, perhaps using a different library of your choosing. I will try to document this better soon.
Hi i get an exception when trying to run Rtf.ToHtml() with the attached rtf value rtf.txt
I'm running the latest version