Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
JohnIssue
Contributor III
Contributor III

exportPd() method is not working for me

I am workin on a Mashup, where I want to include the option to dowload the information in an object as an excel. But I also want to dowload this object in a PDF.

 

The method exportData() is working fine. The way I use it is as follows:
I create the variable: 

var table = $rootScope.global.qlik.table(model),
 
and after that I use:
                    table.exportData(exportOpts).then(function() {
                    });
with my exportOpts previously defined.
 
However, I don't know if I have to define a similar variable to 'table' so that I can use exportPdf() or how I can do it.
 
Anyone could help me?
 
Thanks in advance!!
Labels (4)
1 Solution

Accepted Solutions
alex_colombo
Employee
Employee

Can you please use the code below?

 

$rootScope.global.apps[$rootScope.app].app.visualization.get(qlikid).then(function(object){
	var settings = {
		...
	};

	object.exportPdf(settings).then(function (result) {
		console.log('PDF download link: ', result);
	})
})

 

 

View solution in original post

8 Replies
alex_colombo
Employee
Employee

Hi @JohnIssue , please see our help site on this method where you can find an example on how to use exportPDF method from a visualization.

JohnIssue
Contributor III
Contributor III
Author

@alex_colombo Thank you very much! Anyway, even having seen it, I do not know still how can I make it work

alex_colombo
Employee
Employee

I guess you want to export a Qlik visualization into a PDF, am I right? If so, you have to first get the object with getObject method, then use exportPDF method on the response, as per the example in our help site.

JohnIssue
Contributor III
Contributor III
Author

I mean, I am using:

                 export to PDF:   $rootScope.global.qlik.table(model).exportPdf(exportOpts).then(function() {
                    });

           
                    Export to Excel: $rootScope.global.qlik.table(model).exportData(exportOpts2).then(function() {
                    });
 
The second one works properly but the first one does not.
alex_colombo
Employee
Employee

Are you building a mashup or an extension? Method global.qlik.table is using for accesing table used by an extension object. Can you share the entire code?

JohnIssue
Contributor III
Contributor III
Author

First of all, thank you for your help. I am building a Mashup. When I want to download the data in an object as an excel I use:
 
                $rootScope.global.apps[$rootScope.app].app.getObjectProperties(qlikid).then(function(model) {
                    var table = $rootScope.global.qlik.table(model);
 
                    var exportOpts = {
                      ....
                    };
 
                    $rootScope.global.qlik.table(model).exportData(exportOpts).then(function() {
                    });
                });
 
Which works properly. However, for exporting the visualization into a PDF I am trying with:
 
                $rootScope.global.apps[$rootScope.app].app.getObject(qlikid).then(function (object) {
                    var settings = {
                        ...
                    };
 
                    object.exportPdf(settings).then(function () {                   
                    })
                })
 
When I debug, I get a message that states 'TypeError: object.exportPdf is not a function'.
 
Once again, thank you for your help.
alex_colombo
Employee
Employee

Can you please use the code below?

 

$rootScope.global.apps[$rootScope.app].app.visualization.get(qlikid).then(function(object){
	var settings = {
		...
	};

	object.exportPdf(settings).then(function (result) {
		console.log('PDF download link: ', result);
	})
})

 

 

JohnIssue
Contributor III
Contributor III
Author

It seems to work fine, thank you very much!!