<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Qlik Sense button to export object(s) as images in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-button-to-export-object-s-as-images/m-p/2029283#M17975</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/1709"&gt;@rankassovitz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Great - thank you. It works.&lt;/P&gt;
&lt;P&gt;I changed it from&amp;nbsp;&amp;nbsp;exportImg to&amp;nbsp;exportPdf.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards, Patrick&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jan 2023 11:36:54 GMT</pubDate>
    <dc:creator>pwagner</dc:creator>
    <dc:date>2023-01-24T11:36:54Z</dc:date>
    <item>
      <title>Qlik Sense button to export object(s) as images</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-button-to-export-object-s-as-images/m-p/1562823#M10251</link>
      <description>&lt;P&gt;Hi everyone&lt;/P&gt;&lt;P&gt;We have started using NPrinting, but after creating a report I saw that one of the limitations is that I cannot use Alternate states which is an integral part of my app. I have a few graphs on different sheets and was wondering whether I can create a button to export about 6 objects as images (it can do exactly what the right-click export as Image does). Ideally I would like to be able to give it Object Ids as parameters in the sheet and then click on the button and it cycles through the object Ids I configured and it exports the. This might be a bit complicated so I can event hard code the Ids in the script for now or even create multiple buttons with only one Id in each.&lt;/P&gt;&lt;P&gt;I was wondering whether it is possible with a widget and if anyone has a code snippet I can re-use (I am very new to widgets)?&lt;/P&gt;&lt;P&gt;I built a Reload-App button using an example and was hoping for a similar solution.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Reload app widget. I was hoping for something similar to export the objects." style="width: 925px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/9097i41AB228A11E77C66/image-size/large?v=v2&amp;amp;px=999" role="button" title="Widget.PNG" alt="Reload app widget. I was hoping for something similar to export the objects." /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Reload app widget. I was hoping for something similar to export the objects.&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any other suggestions are welcome.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mauritz&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 06:12:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-button-to-export-object-s-as-images/m-p/1562823#M10251</guid>
      <dc:creator>Mauritz_SA</dc:creator>
      <dc:date>2024-11-16T06:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense button to export object(s) as images</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-button-to-export-object-s-as-images/m-p/2028818#M17973</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/31029"&gt;@Mauritz_SA&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Have you found a solution for your topic?&lt;BR /&gt;Regards, Patrick&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 13:23:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-button-to-export-object-s-as-images/m-p/2028818#M17973</guid>
      <dc:creator>pwagner</dc:creator>
      <dc:date>2023-01-23T13:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense button to export object(s) as images</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-button-to-export-object-s-as-images/m-p/2028996#M17974</link>
      <description>&lt;P&gt;Hello there&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/69334"&gt;@pwagner&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;There are a few ways to go about it while developing a widget or an extension. The&amp;nbsp; main difference between the 2 will be if you want to expose a configuration panel to the app developer (extension).&lt;/P&gt;
&lt;P&gt;When the user clicks on your custom button:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Get the list of object IDs to export (hard coded list, let end user pick from objects on the sheet or let the app developer to pre-define)&lt;/LI&gt;
&lt;LI&gt;Loop through it and run &lt;A href="https://help.qlik.com/en-US/sense-developer/May2022/Subsystems/APIs/Content/Sense_ClientAPIs/CapabilityAPIs/VisualizationAPI/exportImg-method.htm" target="_blank"&gt;app.getObject(ID).exportImg(settings)&lt;/A&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Here's a snippet that will present a downloadable link for each of the objects on the sheet:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;extension.js&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;define( ["qlik", "text!./template.html"],
	function ( qlik, template ) {
		var extId;

		return {
			template: template,
			support: {
				snapshot: true,
				export: true,
				exportData: false
			},
			paint: function ($element, layout) {
				console.log(layout);
				extId = layout.qInfo.qId;
				return qlik.Promise.resolve();
			},
			controller: ['$scope', function ( $scope, layout ) {
				var settings = { format: 'png', height: 600, width: 900 }; // you could create custom properties and gather from layout
				var app = window.app = qlik.currApp();
				var sheetId = qlik.navigation.getCurrentSheetId().sheetId;
				var sheetObjects = [];
				
				$scope.finalObjects = [];
				
				// get objects of current sheet
				$scope.getSheetObjects = function() {
					// console.log(sheetId, extId);
					app.getObject(sheetId).then(function(qSheet){
						sheetObjects = qSheet.layout.qChildList.qItems;
						// console.log(sheetObjects);
						$scope.finalObjects = sheetObjects.filter(function(object) {
							return object.qInfo.qId != extId // filter out the extension object first
								&amp;amp;&amp;amp; object.qInfo.qType != 'filterpane'; // also filter out 'filterpane' -  you can't get an image from them
						});
						// you could now present the user with checkboxes for each of those objects and only then invoke the download
						// or you could automatically start downloading all objects with one click:
						$scope.downloadObjects($scope.finalObjects);
					})
				}
				
				// loop through array and get pngs
				$scope.downloadObjects = function(idArray) {
					console.log(idArray);
					idArray.map(function(object){
						console.log(object);
						app.visualization.get(object.qInfo.qId).then(function(vis){
							console.log(vis);
						  vis.exportImg(settings).then(function (result) {
							console.log('Image download link: ', result);
							object.downloadUrl = result;
							// maybe get binaries of all files and collect them to 1 zip file using a library like JSZip
						  });
						});
					});
				}
			}]
		};

	} );&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;template.html&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;div qv-extension style="height: 100%; position: relative; overflow: auto;" class="ng-scope"&amp;gt;
	&amp;lt;button ng-click="getSheetObjects()"&amp;gt;
		Download Sheet Objects
	&amp;lt;/button&amp;gt;
	
	&amp;lt;ul ng-if="finalObjects.length"&amp;gt;
		&amp;lt;li ng-repeat="o in finalObjects"&amp;gt;
			&amp;lt;a href="{{ o.downloadUrl }}" target="_blank"&amp;gt;{{ o.qData.title }}&amp;lt;/a&amp;gt;
		&amp;lt;/li&amp;gt;
	&amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 23 Jan 2023 19:31:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-button-to-export-object-s-as-images/m-p/2028996#M17974</guid>
      <dc:creator>rankassovitz</dc:creator>
      <dc:date>2023-01-23T19:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense button to export object(s) as images</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-button-to-export-object-s-as-images/m-p/2029283#M17975</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/1709"&gt;@rankassovitz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Great - thank you. It works.&lt;/P&gt;
&lt;P&gt;I changed it from&amp;nbsp;&amp;nbsp;exportImg to&amp;nbsp;exportPdf.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards, Patrick&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 11:36:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-button-to-export-object-s-as-images/m-p/2029283#M17975</guid>
      <dc:creator>pwagner</dc:creator>
      <dc:date>2023-01-24T11:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Qlik Sense button to export object(s) as images</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-button-to-export-object-s-as-images/m-p/2032119#M18010</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/1709"&gt;@rankassovitz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;During my further tests I found out, that in the PDF I find only a certain number of lines. Unfortunately I does not correspond with the shown lines in the Qlik Sense app.&lt;/P&gt;
&lt;P&gt;Do you have an idea what I have to change in the code of the extension?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="pwagner_0-1675168037136.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99273i34CEC5E7D30A0A8A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="pwagner_0-1675168037136.png" alt="pwagner_0-1675168037136.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2023 12:28:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Qlik-Sense-button-to-export-object-s-as-images/m-p/2032119#M18010</guid>
      <dc:creator>pwagner</dc:creator>
      <dc:date>2023-01-31T12:28:40Z</dc:date>
    </item>
  </channel>
</rss>

