Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
PradeepK
Creator II
Creator II

Qlik Visualization API - exportImg method is not working

Kindly Help!!! Can anyone confirm if exportImg() and exportPdf() Visualization API method works.. ? 🤔

exportImg method is not returning any result or any errors.

 official documentation for exportImg method 

Environment : Qlik Sense Desktop November 2020 Patch 3

Code

 

var app = qlik.openApp('Insurance Claims 2020.qvf', config);
app.visualization.get('YAJMNj').then(function (vis) {
    console.log(vis);
    try {
      vis.exportImg( { format: 'png', height: 400,width: 800} ).then(function (result) {
        console.log('Image download link: ', result);
      });
    } catch (err) {
      console.log(err.message);
    }
    console.log("end");
  });

 

 

Result : get method is working ; But exportImg method never returns anything.. not even error.. as shown below. Also this issue is with exportImg() and exportPdf() methods.. exportData() is working fine. 😑

DoReloadResult.PNG

Btw Export Image feature is working in Qlik hub; So it is not the port / setup issue.

DoReload.PNG

 

Labels (4)
1 Solution

Accepted Solutions
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

 

I have this code (you are right about the option):

 

 

 

require( ["js/qlik"], function ( qlik ) {

	//callbacks -- inserted here --
	//open apps -- inserted here --
	var app = qlik.openApp('ecd8451b-973d-4ad1-84cf-b0404bb8275e', config);

	//get objects -- inserted here --
	app.getObject('QV01','92f34e86-73a4-429d-86c9-af5a37820e55');
  var settings = { format: 'png', height: 200, width: 200 }

  app.visualization.get('92f34e86-73a4-429d-86c9-af5a37820e55').then(function(vis){
  vis.exportImg(settings).then(function (result) {
    console.log('Image download link: ', result);
  });
});
} );

 

 

 

 

And the result:

image.png

I use Qlik Sense Novembre 2020 Patch 2

Help users find answers! Don't forget to mark a solution that worked for you!

View solution in original post

9 Replies
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

 

If you try with options like:

 

 

{ format: 'png', height: '400px',width: '800px'}

 

Aurélien

Help users find answers! Don't forget to mark a solution that worked for you!
PradeepK
Creator II
Creator II
Author

Thanks for the Reply.

Yes I have tried this.. but still no luck. it's still not throwing any error or giving any results back.

Also as per official documentation height and width params are of type Number or String... I doubt adding 'px' will help. 

Please let me know if your suggested changes are working for you. Any screenshot for same will be appreciated..

ErikWetterberg

Are you tring to print an extension or a built-in chart?

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

 

I have this code (you are right about the option):

 

 

 

require( ["js/qlik"], function ( qlik ) {

	//callbacks -- inserted here --
	//open apps -- inserted here --
	var app = qlik.openApp('ecd8451b-973d-4ad1-84cf-b0404bb8275e', config);

	//get objects -- inserted here --
	app.getObject('QV01','92f34e86-73a4-429d-86c9-af5a37820e55');
  var settings = { format: 'png', height: 200, width: 200 }

  app.visualization.get('92f34e86-73a4-429d-86c9-af5a37820e55').then(function(vis){
  vis.exportImg(settings).then(function (result) {
    console.log('Image download link: ', result);
  });
});
} );

 

 

 

 

And the result:

image.png

I use Qlik Sense Novembre 2020 Patch 2

Help users find answers! Don't forget to mark a solution that worked for you!
PradeepK
Creator II
Creator II
Author

Default Qlik Objects.

PradeepK
Creator II
Creator II
Author

Thanks for the sample.. It is really helpful.

one more doubt.. is app.getObject() Necessary to use exportImg method ?

 Can PrintingService not create virtual HTML instance for rendering; if using exportImg method on server-side.. ?

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

is app.getObject() Necessary to use exportImg method ?

==> No, you can remove this line 😉

 

Can PrintingService not create virtual HTML instance for rendering; if using exportImg method on server-side.. ?

==> I don't konw, sorry 😕

Help users find answers! Don't forget to mark a solution that worked for you!
PradeepK
Creator II
Creator II
Author

Exactly my thought process.. getObject() should not be required.. but if i remove it.. It's back to square one; No errors No Links. 😑

I guess one Rendered Instance of that object is required..

Let me know if your code still works for you if you remove getObject() Method.

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Yes without this line my code still working, but it's not very fast... the link is generated after 9/10 seconds.

 

 

Help users find answers! Don't forget to mark a solution that worked for you!