Qlik Community

QlikView Extensions

Discussion Board for collaboration on QlikView Extensions.

New Contributor III

why my jsPDF does not work?

Hi experts,

I'm new to QV extensions and JavaScript. I want to create a document extension that uses jsPDF to export some custom charts to pdf. However I'm not able to make it work. I'm using QlikView 11 version.

This is what I did,

create a folder in "C:\Users\usename\AppData\Local\QlikTech\QlikView\Extensions\Document\rrprint"

create a Definition.xml file with contents as below:

<?xml version="1.0" encoding="utf-8"?>
<ExtensionObject Label="rrprint" Path="rrprint" Description="allow share window to export" Type="document">
create a Script.js file with contents as below:
function rrprint_Init() {

function () {
var _this = this;
_this.ExtSettings = {};
            _this.ExtSettings.ExtensionName = 'rrprint';
            _this.ExtSettings.LoadUrl = Qva.Remote + (Qva.Remote.indexOf('?') >= 0 ? '&' : '?') + 'public=only' + '&name=';

// Define one or more javascript files to be used within the extension
var jsFiles = [];
jsFiles.push('Extensions/' + _this.ExtSettings.ExtensionName + '/lib/js/jspdf.debug.js');
Qv.LoadExtensionScripts(jsFiles, function () {
                var d = new jsPDF();

Create sub-folder inside \rrprint folder as .\lib\js\, and put the jspdf.debug.js there.
However, when I run it, I always got error: "jsPDF" is undefined. Is there anything I did incorrectly?
Thank you!


Labels (3)
1 Reply
New Contributor III

Re: why my jsPDF does not work?

Another question is, how to import a web hosted library? 

for example, for jsPDF, the lib url is here: "https://unpkg.com/jspdf@latest/dist/jspdf.min.js",

how should I write it in  LoadExtensionScripts function?

I tried below, but does not work,

var jsFiles = [];
Qv.LoadExtensionScripts(jsFiles, function () {
                var d = new jsPDF();
                d.text(20, 20, 'Hello landscape world!');
receive this error: