From FX to .NET almost perfect

Stimulsoft Reports.NET discussion
Post Reply
hugo
Posts: 359
Joined: Fri Mar 08, 2013 10:46 am

From FX to .NET almost perfect

Post by hugo »

Hello,

I have a specific report that currently runs on client-side thru FX and server-side thru FX+PHP but sometimes the process is locked (besides it's slow).
This is report is complex with several functions, formats, etc, etc so it's a case that push from the report engine.

I needed now another service to also run on server-side with the same report but with 100% of report export to pdf success so my current solution is not an option.

After an evaluation of JS, I saw that there is missing this functions (because it's an young product) but I know already that you are working on that.
Because I need this feature now, I evaluated .NET solution (to run as a webservice side to side with my solution).

First, I want to congratulate the Stimulsoft team. After export to PDF from FX and then from .NET, they are almost identical !

I only found a limitation on .NET side comparing to FX however I found an easy workaround that I share with for the case that you also want to support this on .NET side and get a 100% compatibility between FX and .NET (at least for the features that I evaluated).

About this issue:
On FX I use variables and some of them are to fill images. I use base64string (is a option much more generic than Image that is not support on AS3).
With FX I only need to simple pass the base64string from AS3 to report without any limitation or conversion.
The image component on the report use string as datatype (not Image).

On .NET we get an exception if we configure an Image component as string.
Workaround:
1. Change the report image instances from string datatype to Image;
2. Convert the image datatype from sql (it's a byte array representation of the generic base 64 string):

Code: Select all

report["CompanyLogo"] = Base64ToImage(logo);
3. Here is the method to convert:

Code: Select all

public System.Drawing.Image fromBase64ToImage(byte[] imageBytes)
{
    imageBytes = Convert.FromBase64String(System.Text.Encoding.ASCII.GetString(imageBytes));

    System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBytes, 0, imageBytes.Length);
    ms.Write(imageBytes, 0, imageBytes.Length);
    System.Drawing.Image image = System.Drawing.Image.FromStream(ms, false);
    return image;
}
If you want to support this on the engine, you only have to add this method, allow the Image component to accept string datatype.
Case the Image component is configured as string, you will try to convert the data !
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: From FX to .NET almost perfect

Post by HighAley »

Hello.

We appreciative this question.
We will analyze your request and let you know about results.

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: From FX to .NET almost perfect

Post by HighAley »

Hello.

We have analyzed your request.
We already have StiImageHelper.GetImageFromObject(imageObject) method that is used for StiImage when the image is getting from database.
The imageObject could be Image, string or byte[].
Unfortunately, it's impossible to use this method with variable, because it is compiled with type Image.
So the only way is to use workaround as yours.

Thank you.
hugo
Posts: 359
Joined: Fri Mar 08, 2013 10:46 am

Re: From FX to .NET almost perfect

Post by hugo »

Hello,

OK, this one is not a big issue: I just need to have a client side version of the report (FX) and a server-side version (copy from FX with the image data type changed).

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: From FX to .NET almost perfect

Post by HighAley »

Hello.

Good. Let us know if you need our help.

Thank you.
Post Reply