Exporting reports to PDF format from application deployed to Windows Azure
WebSites sometimes may result in OutOfMemoryException. This problem is mainly caused
by a bug in Azure WebSites platform. Please check the following article for your
article we will describe the workaround that can be used in such situation. Our
example is based on the scenario where GDI+ calls are performed for getting
font metrics. The main idea is to bypass getting the font metrics through GDI+
calls by creating a cache file that contains the required fonts.
1) First of
all we need to create a cache class that should perform writing a cache to a
file. This can be done as displayed in the following article:
2) The next
step is to create a font ranges cache on a local PC by calling the following
3) After the
font ranges cache is created it should be transferred to Azure hosting so it
can be used by the application.
4) To avoid
the possible font problems, check to make sure that the required fonts are
added to a web site custom fonts folder
( prior to performing step 2) and your PDF export is set to read these font files.
can be set from code as follows:
note, this method should be called prior to creation of cache file.