Skip to content

Commit

Permalink
Fixed issue: generate PDF for a single stat is not working
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Nov 5, 2019
1 parent 1fa5dd4 commit 0b7ba65
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions third_party/jspdf/createpdf_worker.js
Expand Up @@ -21,7 +21,7 @@ var CreatePDF = function(){
h_max = 247, w_max = 180,
w_relative = ((w_max/imgData.sizes.w)),
h_relative = ((h_max/imgData.sizes.h));

if(imgData.sizes.h < imgData.sizes.w){
width = w_max;
height = Math.floor((imgData.sizes.h*w_relative));
Expand Down Expand Up @@ -52,11 +52,15 @@ var CreatePDF = function(){
function(imgObjects){
countPages = imgObjects.length;
for( var i in imgObjects){
var imageObject = imgObjects[i];
compileCanvas(i,imageObject);
preparedPages++;
if((preparedPages)<countPages)
doc.addPage();
// Exclude __proto__
// see: https://stackoverflow.com/questions/1107681/javascript-hiding-prototype-methods-in-for-loop
if (imgObjects.hasOwnProperty(i)) {
var imageObject = imgObjects[i];
compileCanvas(i,imageObject);
preparedPages++;
if((preparedPages)<countPages)
doc.addPage();
}
}
resolve("all done");
},
Expand Down Expand Up @@ -103,11 +107,11 @@ var CreatePDF = function(){
unknown : function(method){
return {
success: false,
type: "error",
type: "error",
error: "CRITICAL! Method unknown.",
msg: "Unknown Method: "+method
};
}
}
}
, action = function(method, eventData){
switch(method){
Expand All @@ -119,4 +123,4 @@ var CreatePDF = function(){
}
};
return action;
};
};

0 comments on commit 0b7ba65

Please sign in to comment.