Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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 (2)
33 Replies
agigliotti
Partner - Champion
Partner - Champion

yes I can see the chart.

bortolotti_carl
Partner - Contributor III
Partner - Contributor III

Hi,

We create our own program to capture image, because we have a software similar to nprinting.

CaptureHtml do not work well, because it uses I.E. Activex, and ntml to authenticate is needed.

 

bramkn
Partner - Specialist
Partner - Specialist
Author

Hi @bortolotti_carl 

 

What do you use then?

agigliotti
Partner - Champion
Partner - Champion

Hi @LuQuan182 ,

The problem i'm facing with CaptureHTML is the each time I call it opens a new session with QSE.
Then after 5 calls I get the error "You cannot access Qlik Sense because you have too many sessions active in parallel."

So I have to wait to reach the session timeout limit to be able to export a chart object again.

Regarding the printing service of Qlik , do you mean using Visualization API https://help.qlik.com/en-US/sense-developer/November2019/Subsystems/APIs/Content/Sense_ClientAPIs/Ca... ?

Do you think is it possible to use it with my .net c# solution ?

bramkn
Partner - Specialist
Partner - Specialist
Author

@agigliotti 

Please read the whole topic. As it talks about using the printing service of Qlik.

I use it in my C# .net application to get images from the Qliksense server and export as many images as i want without any session issues. It is not the visualisation API.

Using the printing service is doing what Qlik Sense it self does to get the images exported. You can examine the POST call Qlik makes when exporting an image in the browser. Then build this POST Request body within your application and make the POST request to the server. The Body can be build up with data you can get from the Engine.(.NET SDK).

The POST Request is sent to the Printing service of QlikSense. Hence the talk of using the printing service.

agigliotti
Partner - Champion
Partner - Champion

Hi @bramkn ,

I took a look at Request Payload with Chrome dev tools.
I can't find how to get data to build the POST request body.

Also i don't understand the following URL:

POST /printing/export/object/image?requestId=1d5f0052-433a-4e18-ba58-2c399b7abdee

because "1d5f0052-433a-4e18-ba58-2c399b7abdee" is actually the .png image being generated in  C:\ProgramData\Qlik\Sense\Repository\TempContent folder on QSE.

Could you help me with some snippet code of your c# .net application ?

Many thanks in advance.

bramkn
Partner - Specialist
Partner - Specialist
Author

@agigliotti 

I will not provide my code.

The GUID is the request ID. and your reference for this request. its not actually the image. The image is just named like that with the export.

agigliotti
Partner - Champion
Partner - Champion

i don't want your code of course...

anyway it does not matter, i'll find the solution by myself as always...

agigliotti
Partner - Champion
Partner - Champion

i'm struggling with the body of tje POST request.

Specifically I don't know how to pass the snapshotData, take a look at the example below:

body of the POST request sent to Qlik Printing Service:

{
"imageType": "Png",
"appName": "YYYYYY",
"appId": "001e3853-02dd-46b5-95e2-fc0055d38393",
"captureSize": {
"width": 648,
"height": 481,
"dpi": 96
},
"objTree": {
"id": "BxMZKc",
"type": "barchart",
"snapshotData": "?????",
"children": [],
"isExtension": false,
"title": "xxxxxx",
"area": {
"left": 0,
"top": 0,
"width": 1,
"height": 1
}
}
}

Where can I find the string value of snapshotData to pass to the request ?
I already tried with AbstractStructure.PrintStructure() but the image is not being generated.
the status response of the get request is "Processed" rather than "Completed" and without "qUrl" parameter.

Could someone help me?

bramkn
Partner - Specialist
Partner - Specialist
Author

Hi @agigliotti 

 

When you analyse the Post call Qlik makes when exporting an image you will see what to fill in there.

The is an option within de SDK to create a snapshot. You can do that and get the string value from that.