Hello,
I am running on the latest version of the Aspose .net suite. We have a situation where things work fine on premises however when we deploy to the Azure Paas App Service Web App we get the “Generic Error in GDI+” error message.
My question is, when creating a document that has images (svg images) does the aspose products try to write any files to disc, even temporarily? If so where? My Code is below, however this doesn’t seem to be a code issue as it runs on site.
Any help would be greatly appreciated. The customer is talking about scraping all of Aspose due to this but I know it is the right product. Please help me keep your product in the mix. 
Code Below: Error ALWAYS happens at
wordDocumentBuilder.InsertHtml(htmlContents,true);
internal static byte[] ExportTo(this string htmlContents, ExportFormat exportFormat, DocumentAccess documentAccess, IAttachmentService attachmentService, string documentExportDate)
{
htmlContents = Regex.Replace(htmlContents, "&", "&", RegexOptions.Compiled);
htmlContents = Regex.Replace(htmlContents, "", " ", RegexOptions.Compiled);
if (exportFormat == ExportFormat.Pdf)
{
htmlContents = Regex.Replace(htmlContents, "", " ", RegexOptions.Compiled);
}
// Install aspose license
License license = new License();
license.SetLicense("Aspose.Total.lic");
Document wordDocument = new Document();
DocumentBuilder wordDocumentBuilder = new DocumentBuilder(wordDocument);
wordDocument.ResourceLoadingCallback = new ResourceLoadingHandler
{
AttachmentService = attachmentService
};
wordDocumentBuilder.InsertHtml(htmlContents, true);
// Resize images to fit into exported file
var paras = wordDocument.GetChildNodes(NodeType.Paragraph, true);
foreach (Paragraph para in paras)
{
if (para.IsListItem)
{
for (int i = 0; i < para.ListFormat.List.ListLevels.Count; i++)
{
para.ListFormat.List.ListLevels[i].Alignment = Aspose.Words.Lists.ListLevelAlignment.Left;
}
}
}
// Resize images to fit into exported file
var tbls = wordDocument.GetChildNodes(NodeType.Table, true);
foreach (Table tbl in tbls)
{
tbl.AllowAutoFit = false;
tbl.PreferredWidth = Aspose.Words.Tables.PreferredWidth.FromPercent(90);
}
InsertFooter(wordDocumentBuilder, exportFormat, documentAccess, documentExportDate);
var saveFormat = SaveFormat.Docx;
switch (exportFormat)
{
case ExportFormat.Word:
saveFormat = SaveFormat.Docx;
break;
case ExportFormat.Pdf:
saveFormat = SaveFormat.Pdf;
break;
case ExportFormat.Text:
saveFormat = SaveFormat.Text;
break;
}
// Custom formatting of exported document in order to get expected look-n-feel
foreach (Section section in wordDocument.Sections)
{
section.PageSetup.LeftMargin = 20;
section.PageSetup.RightMargin = 20;
}
// Resize images to fit into exported file
var images = wordDocument.GetChildNodes(NodeType.Shape, true);
foreach (Shape image in images)
{
if (!image.HasImage)
{
continue;
}
if (image.Width > 532)
{
image.Height = image.Height * (532 / image.Width);
image.Width = 532;
}
if (image.Height > 620)
{
image.Height = 620;
}
}
var convertedDocumentStream = new MemoryStream();
wordDocument.Save(convertedDocumentStream, saveFormat);
convertedDocumentStream.Position = 0;
return convertedDocumentStream.ToArray();
}
Hi Travis,
Thanks for your inquiry. We suggest you please read following web links for your kind reference.
It seems that you are facing this issue only at Azure. Please share if you are facing this issue at Azure only. It would be great if you please share complete stack trace here for our reference.
Travis Falls:
My question is, when creating a document that has images (svg images) does the aspose products try to write any files to disc, even temporarily? If so where?
We are in communication with our product team about your query and will update you soon.
I am only facing this issue in Azure. This works fine (same code) on prem. I think I found something it seems the aspose software is looking in %windir%/fonts and then in the registry. This will not work in Azure PaaS situations.
Hi Travis,
Thanks for sharing the detail. We have logged a ticket in our issue tracking system as WORDSNET-13290 to investigate the usage of Aspose.Words with Azure Paas App Service Web App. Your request has also been linked to this issue. We will update you via this forum thread once there is any update available on this issue.
We apologize for your inconvenience.
Hello,
I haven’t heard anything on this matter. please update me with what is going on so that I can plan accordingly with my team. Right now this is 100% a blocker for my team and our project.
Can you provide me with a list of directories that Aspose Suite needs access to for reading as well as for writing? For example I discovered at one point Aspose is trying to %windir%/fonts
Can you provide me a list of all the folder/file access and write points? thank you
Hi Travis,
Thanks for your inquiry.
Travis Falls:I haven't heard anything on this matter. please update me with what is going on so that I can plan accordingly with my team. Right now this is 100% a blocker for my team and our project.
Currently, WORDSNET-13290 is pending for analysis. We will update you via this forum thread once there is any update available on this issue. Thanks for your patience.
Travis Falls:Can you provide me with a list of directories that Aspose Suite needs access to for reading as well as for writing? For example I discovered at one point Aspose is trying to %windir%/fonts Can you provide me a list of all the folder/file access and write points?
Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (PDF, XPS or SWF). Please read "Font Availability and Substitution" section from following documentation link.
Regarding writing files to disk, we are in communication with our product team. We will get back to you soon.
We apologize for your inconvenience.
Hi Travis,
Thanks for your patience.
Travis Falls:
My question is, when creating a document that has images (svg images) does the aspose products try to write any files to disc, even temporarily? If so where?
Aspose.Words saves to disk nothing while importing html or SVG into Aspose.Words DOM using DocumentBuilder.InsertHtml.
However, when Aspose.Words saves a document, it needs to create temporary internal structures. By default, these internal structures are created in memory and the memory usage spikes for a short period while the document is being saved. When saving is complete, the memory is freed and reclaimed by the garbage collector. So, Aspose.Words does not save any file at disk.
Travis Falls:
Code Below: Error ALWAYS happens at
wordDocumentBuilder.InsertHtml(htmlContents,true);
It seems that this issue is an Azure bug. Inserting pure HTML code without SVG works fine at our end.
Hi, does your response mean that this feature won’t work on windows Azure Web App?
I am still getting this on v16.7. I have tried substituting the fonts folder with FontSettings.SetFontFolder, but it still doesn’t resolve it.
You mention that it’s calling “system functions” that resolve to those native windows file locations. What CLR methods are being called?
G
Hi Graham,
Thanks for your inquiry. This issue reported in this forum thread seems an Azure bug. Inserting pure HTML code without SVG works fine at our end.
graham.laidler@harbourassist.com:
You mention that it's calling "system functions" that resolve to those native windows file locations. What CLR methods are being called?
We are in communication with our product team about your query and will get back to you soon.
The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan
The issues you have found earlier (filed as WORDSNET-13290) have been fixed in this Aspose.Words for .NET 23.5 update also available on NuGet.