Posted 19 October 2020, 3:12 am EST
Hi,
We would like to know if it’s possible to bind an image that comes from an assembly to one of our reports.
We have a report that for each page calls an API endpoint to retrieve a dynamic image potentially 31 times (one for each day of the calendar). This methodology is proving to be really slow specially when we have reports with 50+ pages (31*50 = 1550 calls).
For this reason we started using custom code on said report (by adding a reference to a DLL) and we have an Image control that seems to be fetching the image through the DLL with no issues but it isn’t binding it on the report properly (we get a blank image only). We know the DLL reference is working properly because we tested it on other TextBox Elements.
I’ve tried using the following methods:
public static Image GetHoursImage(string hours, string ncs)
public static FileStream GetHoursImage(string hours, string ncs)
public static byte[] GetHoursImage(string hours, string ncs)
If I use ```
File.WriteAllBytes(“test.jpeg”, testImg);
I've also done some speed tests matching the web service implementation vs the assembly implementation and for a report with 52 pages I got the following timings when exporting to pdf:
- Web Service -> 41s
- Assembly -> 8s
This is the code for both implementations:
HoursImage 0.32cm 2.04895cm image/bmp Fit<Image Name="HoursImage"> <DataElementName>HoursImage</DataElementName> <Height>0.32cm</Height> <Left>2.04895cm</Left> <MIMEType>image/bmp</MIMEType> <Sizing>Fit</Sizing> <Source>External</Source> <Value>=Fields!BaseUrl.Value & "/api/ReportImage/" & Fields!Hours.Value</Value> <Width>11.4992cm</Width> <ZIndex>232</ZIndex> </Image>