Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
Qlik Launches Open Lakehouse and advanced agentic AI experience in Qlik Answers! | LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ajaykakkar93
Specialist III
Specialist III

Error in exporting chart to Image or PDF using Qlik Sense API

Hello Everyone,

i am facing a issue in November 2018,

i am not able to export as PDF or IMAGE, but i am able to export the data to excel i need to implement other export feature as well it will be great if you and others can help me on this issue.

exportPdf_exportImg_issue.PNG






Same error is coming for IMG also

My simple test code

 

var prefix = window.location.pathname.substr(0, window.location.pathname.toLowerCase().lastIndexOf("/extensions") + 1);
var config = {
	host: window.location.hostname,
	prefix: prefix,
	port: window.location.port,
	isSecure: window.location.protocol === "https:"
};
require.config({
	baseUrl: (config.isSecure ? "https://" : "http://") + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"
});
require(["js/qlik"], function(qlik) {
	qlik.setOnError(function(error) {
		$('#popupText').append(error.message + "<br>");
		$('#popup').fadeIn(1000);
	});
	$("#closePopup").click(function() {
		$('#popup').hide();
	});
	//callbacks -- inserted here --
	//open apps -- inserted here --
	var app = qlik.openApp('APP-ID', config);
	//get objects -- inserted here --
	// test
	app.getObject('QV01', 'OBJID').then(function(visual) {
		//console.log(visual);
		$("#exportChart").show().click(function() {
			//Working Good
			/*
			visual.exportData().then(function(result) {
				console.log('Data download link: ', result);
			});
			*/
			//Not Working IMG
			/*
				var Imgsettings = {
					imageType: 'png',
					height: 200,
					width: 300
				};
				visual.exportImg(Imgsettings).then(function(result) {
					console.log('Image download link: ', result);
				});
			*/
			//Not Working PDF
			var Pdfsettings = {
				documentSize: "A4",
				aspectRatio: 2,
				orientation: "landscape"
			};
			visual.exportPdf(Pdfsettings).then(function(result) {
				console.log('Pdf download link: ', result);
			});
			console.log("Exporting");
		});
	});
	//create cubes and lists -- inserted here --
});

Can some one help me on this &  please if i am wrong please explain me what was wrong.

 

Regards,

Ajay Kakkar

Please mark the correct replies as Solution. Regards, ARK
Profile| GitHub|YouTube|Extension|Mashup|Qlik API|Qlik NPrinting

Labels (2)
31 Replies
DBIT
Contributor III
Contributor III

Wonderful. I’ve wasted a lot of time trying to work this out and it’s for the wrong version 😂

I will need to look at the client managed only.

DBIT
Contributor III
Contributor III

Thanks again for guidance so far. Seems I've been looking at the wrong one, but I don't see any examples for exporting charts and tables with client managed, only apps? 

A little more direction to get this done if possible would be very much appreciated.

Øystein_Kolsrud
Employee
Employee

As I wrote earlier, the APIs for the printing service in the client managed version of Qlik Sense are not public. And there are no examples available for how to do this as far as I know. The only way forward would be for you to reverse engineer the traffic you see in the client when you print from there. I'm afraid I can't give more direction than that, because I don't know this part very well myself.

DBIT
Contributor III
Contributor III

No worries. I appreciate all the help to get this far. Much appreciated.

 

If I manage to do it, I'll post back. 🙂

DBIT
Contributor III
Contributor III

So I ended up moving the app we need to export from to Qlik SAAS in the cloud and I am now able to export Qlik native objects from it using the API easily enough. I am however getting "chart type not allowed" error response when trying to do the same for custom extensions. I suspect this may be due to the exportable option in the extensions but unless I haven't coded it in correctly on the extension, that is already set to true.

I wonder, is this anything you've encountered before or may know how to solve? 

Øystein_Kolsrud
Employee
Employee

Is it possible to export the same extension from the Qlik Sense client?

DBIT
Contributor III
Contributor III

Hi, yes I have copied the extension enterprise to the cloud instance. I have also checked the object is using the extension before it was duplicated in the cloud.

Øystein_Kolsrud
Employee
Employee

I mean are the print options available in the Qlik GUI for the extension? Not all visualizations are exportable even there.

DBIT
Contributor III
Contributor III

Ah sorry, yes they are. I can export it using GUI right click no problem.

DBIT
Contributor III
Contributor III

Just checked again. Seems they are in the enterprise version but when the same extension is passed over to the cloud version, only data is available in the GUI menu.

I'm hoping there's a way around this?
OSZAR »