Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
tlorimier
Partner - Contributor III
Partner - Contributor III

Export to image and App API not working

Hello community,

I found some problem with Qlik Sense (working on QS 3.1) with the export to image (or pdf) function for an extension object.

The export is working just fine for the extension if you don't use external elements (as written inside the documentation) :

The following limitations apply:

  • Qlik Sense does not support exporting or printing of visualization extensions that use external resources.
  • Qlik Sense does not support exporting or printing of visualization extensions that use internal and undocumented JavaScript modules or APIs.
  • When exporting as an image, the maximum size that can be exported is 2,000 by 2,000 pixels. If the export would result in a larger image, the user must reduce the size under Custom in the Export as an image dialog in the app.

So my question here is : why the export is not working when you are using some function of the App API (like createCube) ?

Or does Qlik Sense not support his own API (like the App API) for the export ?

Do you have the same problems ? Or maybe there is a workaround to export with the App API ? Or maybe i'm not reading correctly the documentation ...

Regards,

Thibaut

5 Replies
Alexander_Thor
Employee
Employee

Because when printing occurs a snapshot (a copy of the layout) is taken of the object and sent to the printing service.
The printing service then renders the object without a connection to QIX and produces a image. So if you are relying on a connection to the Engine inside the paint function then printing will fail. You probably want to push operations like that into the controller and let your paint function be stateless.

tlorimier
Partner - Contributor III
Partner - Contributor III
Author

Ok for the context, i understand now why it's not working.

For the part about the controller and paint stateless i'm a little confused.

What i understand is :

- You can use Angular JS or not to render your extension.

First case : Use only paint function

In this case the only we have only the paint function and we must call inside the paint our different API to get some element like the createCube function that allow us to query an hypercube each time the paint is called.

With this kind of method

   return { // Define what our properties panel look like definition: { }, //Paint resp.Rendering logic   paint: function ( $element, layout ) {  } };

With what you explained it means that the extension cannot be compatible with the export and use some element of the API (in my case createCube) at the same time.

Second case : Use AngularJS to render the extension

In this case i'm not very sure but you render your extension with this kind of method

define( [ 'angular' ], function ( angular ) {  return { ... controller: ['$scope', function ( $scope ) { $scope.angularVersion = angular.version; }] }; } );

In this case you work inside the controller function but there is no paint element, or i'm missing something ?

Or maybe like you said there is 2 different function : a controller and a paint element (that must be stateless to work with export). I don't use too much the AngularJS case, the controller function is called each time there is a paint ? Or only once during the init of the extension ?

Thanks for your reply !

Regards,

Thibaut

Alexander_Thor
Employee
Employee

Hey,

(Strapped on time here so I'll come back with a longer reply later)
Here is a example: d3proposal.js · GitHub


Yes, the controller only runs once so you can manage what's on scope. The paint function is still called on every render.

tlorimier
Partner - Contributor III
Partner - Contributor III
Author

Thanks for the example, i will to try to create a new extension with some function of the APP Api then try to export it.

Will let you know once i have finished the test.

Regards,

Thibaut

tlorimier
Partner - Contributor III
Partner - Contributor III
Author

Hi again,

I just tried to create an extension and sadly it didn't work like I expected.

I got the controller that call correctly the createCube function (APP Api) during the init of the extension.

https://help.qlik.com/en-US/sense-developer/3.1/Subsystems/APIs/Content/MashupAPI/Methods/createCube...

The paint do nothing (and the same for the resize), but the export is not working, it loops till an error is send (timeout).

I can call qlik.currApp() inside the controller and the export is working well but when I use qlik.currApp().createCube() it loops ...

I can send you the extension if you want. I tried to mix your extension and this one for the test :

https://github.com/stefanwalther/sense-extension-recipes/tree/master/HyperCubeOnTheFly

Maybe the callback is the problem ? If you got some deeper example i'm glad to have them.

Regards,

Thibaut