qlik-oss/picasso.js

Export picasso visualization as image or pdf

hill84 opened this issue ยท 1 comments

Hi everybody! ๐Ÿ‘‹
I want to export a custom chart visualization I created with Picasso.js in a Qlik sense mashup (created with React.js) as Pdf or image. I've been able to set a function to export the same chart as data (.xlsx), but when I try to export it as image or Pdf I receive an "Internal Server Error" (on server) or a "Blocked by CORS warning" (on localhost). The same functions work well with embedded Sense visualizations.

I am using the exportPdf and exportImg methods of the Visualization API.

My issue seams the same as this topic in the Qlik Community Forum.

What am I doing wrong? ๐Ÿ˜ญ

My function:

qApp.visualization.get(objectId).then(qViz => {
  qViz.exportPdf(settings).then(res => {
    this.downloadURI(res, fileName);
  }).catch(err => console.log(err)); // ERROR
}).catch(err => console.log(err));

The server error:

POST https://40.113.14.238/printing/export/object/pdf?requestId=957dc6b8-3e3b-4fdd-94c8-ae3dddc87411 500

The local error:

Access to XMLHttpRequest at 'http://localhost:9073/printing/export/object/image?requestId=61981b8a-d45b-4dfb-a622-e1f19dd65027' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

My mashup config:

"DESKTOP": {
    host: 'localhost',
    secure: false,
    port: 4848,
    prefix: '',
    appId: 'appname.qvf'
  }

Hi @hill84,

Exporting and Visualization API in Qlik is not managed by picasso, you might wanna try https://community.qlik.com/t5/Qlik-Sense-Integration/bd-p/qlik-sense-integration-extension-api