Export Document doesn't work when the project is hosted inside Azure cloud
Export Document doesn't work when the project is hosted inside Azure cloud
Hello,
I am working in silverlight project. When i use report.ExportDocument(StiExportFormat.Pdf, file), it works fine and i am able also to write to memory stream without any errors.
But when i add cloud service project in order to host my web application in the cloud, i got "Out of Memory Exception". Same code works fine when i unload cloud project.
I spent a lot of time trying to solve this issue but still same error.
Regards,
Jalal
I am working in silverlight project. When i use report.ExportDocument(StiExportFormat.Pdf, file), it works fine and i am able also to write to memory stream without any errors.
But when i add cloud service project in order to host my web application in the cloud, i got "Out of Memory Exception". Same code works fine when i unload cloud project.
I spent a lot of time trying to solve this issue but still same error.
Regards,
Jalal
Export Document doesn't work when the project is hosted inside Azure cloud
Hello Jatal,
Please show me full error stack.
Thank you.
Please show me full error stack.
Thank you.
Export Document doesn't work when the project is hosted inside Azure cloud
System.OutOfMemoryException was unhandled by user code
Message=Out of memory.
Source=System.Drawing
StackTrace:
at System.Drawing.Graphics.FromHwndInternal(IntPtr hwnd)
at System.Drawing.Graphics.FromHwnd(IntPtr hwnd)
at Stimulsoft.Report.Export.PdfFonts.GetFontMetrics(Font font, PdfFontInfo currentFontInfo, UInt16[] glyphMap)
at Stimulsoft.Report.Export.PdfFonts.InitFontsData()
at Stimulsoft.Report.Export.StiPdfExportService.ExportPdf(StiReport report, Stream stream, StiPdfExportSettings settings)
at Stimulsoft.Report.StiReport.ExportDocument(StiExportFormat exportFormat, StiExportService exportService, Stream stream, StiExportSettings settings)
at Stimulsoft.Report.StiReport.ExportDocument(StiExportFormat exportFormat, Stream stream, StiExportSettings settings)
at Stimulsoft.Report.StiReport.ExportDocument(StiExportFormat exportFormat, Stream stream)
at TestPP.Web.ExportDocument.ExportDocument2Pdf(String documentTypeId, String xmlData, String internalDocumentId) in C:\Users\Jalal.DOMAIN\Documents\Visual Studio 2010\Projects\estPP.Web\ExportDocument.asmx.cs:line 107
InnerException:
using (MemoryStream memstr = new MemoryStream())
{
report.ExportDocument(StiExportFormat.Pdf, memstr); // Error occurred here!
}
Message=Out of memory.
Source=System.Drawing
StackTrace:
at System.Drawing.Graphics.FromHwndInternal(IntPtr hwnd)
at System.Drawing.Graphics.FromHwnd(IntPtr hwnd)
at Stimulsoft.Report.Export.PdfFonts.GetFontMetrics(Font font, PdfFontInfo currentFontInfo, UInt16[] glyphMap)
at Stimulsoft.Report.Export.PdfFonts.InitFontsData()
at Stimulsoft.Report.Export.StiPdfExportService.ExportPdf(StiReport report, Stream stream, StiPdfExportSettings settings)
at Stimulsoft.Report.StiReport.ExportDocument(StiExportFormat exportFormat, StiExportService exportService, Stream stream, StiExportSettings settings)
at Stimulsoft.Report.StiReport.ExportDocument(StiExportFormat exportFormat, Stream stream, StiExportSettings settings)
at Stimulsoft.Report.StiReport.ExportDocument(StiExportFormat exportFormat, Stream stream)
at TestPP.Web.ExportDocument.ExportDocument2Pdf(String documentTypeId, String xmlData, String internalDocumentId) in C:\Users\Jalal.DOMAIN\Documents\Visual Studio 2010\Projects\estPP.Web\ExportDocument.asmx.cs:line 107
InnerException:
using (MemoryStream memstr = new MemoryStream())
{
report.ExportDocument(StiExportFormat.Pdf, memstr); // Error occurred here!
}
Export Document doesn't work when the project is hosted inside Azure cloud
Hello,
We made some tests in this direction. Azure have strange troubles when we start using gdi or gdi plus.
We added a new feature. Now export to PDF can use previously prepared font files, and GDI functions are not invoked in the export process.
How it works:
- using the utility, that is attached to the e-mail, you create font files (*.fiz)
- in the init part of your application you load these files to the font store, for example:
Stimulsoft.Report.Export.FontsInfoStore.LoadFontInfoToStore("Arial", @"D:\Arial.fiz");
- export searches these fonts in the store first; if they are found then it uses them from the store, if it does not find them then it gets them from GDI as it was realized earlier.
Thank you.
We made some tests in this direction. Azure have strange troubles when we start using gdi or gdi plus.
We added a new feature. Now export to PDF can use previously prepared font files, and GDI functions are not invoked in the export process.
How it works:
- using the utility, that is attached to the e-mail, you create font files (*.fiz)
- in the init part of your application you load these files to the font store, for example:
Stimulsoft.Report.Export.FontsInfoStore.LoadFontInfoToStore("Arial", @"D:\Arial.fiz");
- export searches these fonts in the store first; if they are found then it uses them from the store, if it does not find them then it gets them from GDI as it was realized earlier.
Thank you.
- Attachments
-
- 657.FontsInfoCreator.zip
- (99.12 KiB) Downloaded 455 times
Export Document doesn't work when the project is hosted inside Azure cloud
Hello Ivan,
Loading Font type solve the issue. It works well now.
Thanks a lot.
Regards,
Jalal
Loading Font type solve the issue. It works well now.
Thanks a lot.
Regards,
Jalal
Export Document doesn't work when the project is hosted inside Azure cloud
Hello,
Great! Have a good day!
Great! Have a good day!
Re: Export Document doesn't work when the project is hosted inside Azure cloud
Hi,
I know it is 8 years before topics. But I encounter exactly the same issue on PDF export that if my Application hosted on Azure App Service.
If the report is using Arial font only, the above method LoadFontInfoToStore solve the issue.
However, if the report is using "Arial Unicode MS" font, "Out of Memory Exception" occurred again.
Am I missing something?
Regards,
Jansen
I know it is 8 years before topics. But I encounter exactly the same issue on PDF export that if my Application hosted on Azure App Service.
If the report is using Arial font only, the above method LoadFontInfoToStore solve the issue.
However, if the report is using "Arial Unicode MS" font, "Out of Memory Exception" occurred again.
Am I missing something?
Regards,
Jansen
-
- Posts: 6255
- Joined: Tue Mar 20, 2018 5:34 am
Re: Export Document doesn't work when the project is hosted inside Azure cloud
Hello,
Please clarify which product and version are you use?
Thank you.
Please clarify which product and version are you use?
Thank you.
Re: Export Document doesn't work when the project is hosted inside Azure cloud
It is Stimulsoft.Reports.Web 2018.3.1.0.
I can recreate the issue using the sample download from
https://www.stimulsoft.com/en/samples/a ... the-viewer
If nothing is modified and deploy it to Azure App Service, Out of Memory occurred. (No problem if running locally)
If Arial.fiz is created and added these lines to Page_Load
Issue resolved.
However, if the font in report are changed from "Arial" to "Arial Unicode MS" (or even just add one text box that the font is "Arial Unicode MS")
Create the "Arial Unicode MS.fiz" and modified the code in Page_Load
Out of Memory Exception occurred again by selecting "Save" > "Adobe PDF File..."
Here is the deployed site for the testing
https://showreportintheviewer2018102008 ... sites.net/
Any help is appreciated.
Regards
Jansen
I can recreate the issue using the sample download from
https://www.stimulsoft.com/en/samples/a ... the-viewer
If nothing is modified and deploy it to Azure App Service, Out of Memory occurred. (No problem if running locally)
If Arial.fiz is created and added these lines to Page_Load
Code: Select all
string fontPath = Server.MapPath("Data/Arial.fiz");
Stimulsoft.Report.Export.FontsInfoStore.LoadFontInfoToStore("Arial", fontPath);
However, if the font in report are changed from "Arial" to "Arial Unicode MS" (or even just add one text box that the font is "Arial Unicode MS")
Create the "Arial Unicode MS.fiz" and modified the code in Page_Load
Code: Select all
string fontPath = Server.MapPath("Data/Arial.fiz");
Stimulsoft.Report.Export.FontsInfoStore.LoadFontInfoToStore("Arial", fontPath);
string fontPath2 = Server.MapPath("Data/Arial Unicode MS.fiz");
Stimulsoft.Report.Export.FontsInfoStore.LoadFontInfoToStore("Arial Unicode MS", fontPath2);
Out of Memory Exception occurred again by selecting "Save" > "Adobe PDF File..."
Here is the deployed site for the testing
https://showreportintheviewer2018102008 ... sites.net/
Any help is appreciated.
Regards
Jansen
Re: Export Document doesn't work when the project is hosted inside Azure cloud
Hello, Jansen.
It seems that the issue is connected with getting font file on Azure.
We have created the FontInfoCreator utility.
This project creates a font info file for the PDF export that allows using the fonts on Azure Web Sites and other servers that have a restriction on access to GDI+.
To use the font info file you should add the information about the necessary fonts to FontsInfoStore with the following:
Stimulsoft.Report.Export.FontsInfoStore.LoadFontInfoToStore("Arial", "Arial.fiz");
This utility allows of getting these files data for the export without the need to use GDI.
Thank you.
It seems that the issue is connected with getting font file on Azure.
We have created the FontInfoCreator utility.
This project creates a font info file for the PDF export that allows using the fonts on Azure Web Sites and other servers that have a restriction on access to GDI+.
To use the font info file you should add the information about the necessary fonts to FontsInfoStore with the following:
Stimulsoft.Report.Export.FontsInfoStore.LoadFontInfoToStore("Arial", "Arial.fiz");
This utility allows of getting these files data for the export without the need to use GDI.
Thank you.