Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bramkn
Partner - Specialist
Partner - Specialist

.NET SDK C# Image Export

Hi,

So the people using JS got the Image export available with their API.

Is there anyone that found a way to do this within C#? 

Apparently the API's for this are not public, but why??

 

I have got it to work with opening a browser and navigating through it to export the image and get it from the server. But this is not really reliable to use.

If the API's are not going to be public, is there a way to for example put a bit of JS within the application and handle this image export for the C# bit? If so does it need any install of node.js for example? I have not worked with JS and the Qlik API's.

If someone would be able to provide sample code for this last bit, that would be really awesome.

Labels (7)
33 Replies
bramkn
Partner - Specialist
Partner - Specialist
Author

Hi @LuQuan182 

I am sorry I have only used the session cookies within Qlik scripting for the NPrinting API.

Never used it to connect to the Engine or anything like that. Also haven't used .NetCore sofar.

Hope someone will be able to help on the dedicated post. Also the Qlik Branch Slack is very helpful for these kind of questions. There is some great people that that can help with almost everything.

agigliotti
Partner - Champion
Partner - Champion

did you find any solution?

please let me know.

BR
Andrea

LuQuan182
Partner - Contributor II
Partner - Contributor II

Ciao @agigliotti ,

 

Personally i tried 2 ways:

- Printing service of Qlik, as @bramkn already said, it's possible to rebuild the API call done from the Browser client when you export an graph as image. Personally i found some problem about filters logics few months ago.

- Done an image capture of  the webpage retried via single integration API with the .exe found here: https://github.com/qlik-bots/QlikBotNet/tree/master/CaptureHTML

 

Lu Quan

bramkn
Partner - Specialist
Partner - Specialist
Author

Hi @LuQuan182 

What issues were u having with filters? I don't have any issues with using the printing service so far.

LuQuan182
Partner - Contributor II
Partner - Contributor II

 

 

Hi @bramkn , 

i found that the printing service takes a statics value from the json and it creates a chart, 

so in my case i'm not able to use it as a stand alone service.

bramkn
Partner - Specialist
Partner - Specialist
Author

@LuQuan182  

 

Ah yes thats correct. I am using it for creating reports so for me its perfect. 🙂

agigliotti
Partner - Champion
Partner - Champion

Currently i'm using the CaptureHTML program with the below code:
the url is "http://localhost/single/?appid=001e3853-02dd-46b5-95e2-fc0055d38393&obj=485a3f6f-5d28-48de-9b95-919602c3c039"
/*****/
try
{
using (Process exeProcess = Process.Start(startInfo))
{
exeProcess.WaitForExit(AppTimeout);
if (exeProcess.HasExited)
{
await BotSendPhotoMessage(chatID, Caption, ImageFile);
return true;
}
else
{
botLog.AddBotLine("Error capturing chart image", LogFile.LogType.logError);
exeProcess.Kill();
return false;
}
}
}
catch (Exception e)
{
botLog.AddBotLine(string.Format("Failed sending a chart image: {0}", e), LogFile.LogType.logError);
return false;
}
/*****/

The problem i'm facing is with the png image that is empty , while debugging the code it's well generated.
It seems the image capture is done before the web page is completely rendered...
"AppTimeout" is 6 seconds.
What could be the reason?
Can someone help me? @kaushiknsolanki , @Alexander_Thor , @bortolotti_carl , @bramkn 
Many thanks in advance for your time.

Best regards
Andrea

LuQuan182
Partner - Contributor II
Partner - Contributor II

Hi @agigliotti ,

The .exe uses internet explorer as browser, make sure have configurated the credential to it.

Otherwise you can increase the AppTimeout.

Lu Quan

agigliotti
Partner - Champion
Partner - Champion

Hi @LuQuan182 

what do you mean with "make sure have configurated the credential to it" ?
also running CapureHTML.exe with the same parameters from cmd it works fine.
I alo tried increasing the AppTimeout with the same result.

LuQuan182
Partner - Contributor II
Partner - Contributor II

@agigliotti

 

if you open the chart url with internet explorer, you can see the chart?,

if yes i don't know what could be you problem.

 

Lu Quan