diff --git a/lib/zin/wg/gantt/js/v1.js b/lib/zin/wg/gantt/js/v1.js index 137681f2f3..b39b663cd2 100644 --- a/lib/zin/wg/gantt/js/v1.js +++ b/lib/zin/wg/gantt/js/v1.js @@ -122,6 +122,26 @@ function drawGanttToCanvas(exportType, successCallback, errorCallback) afterFinish(canvas); if(errorCallback) errorCallback('Cannot convert image to blob.'); }; + let width = canvas.width; + let height = canvas.height; + getRemoteScript(jsRoot + 'js/pdfjs/min.js', function() + { + updateProgress(0.8); + let pdf = new jsPDF( + { + format: [width, height], + unit: 'px', + orientation: width > height ? 'l' : 'p' + }); + pdf.addImage(canvas, 0, 0, pdf.internal.pageSize.getWidth(), pdf.internal.pageSize.getHeight()); + pdf.save(fileName + '.pdf'); + if(successCallback) successCallback(pdf); + afterFinish(); + }, function(error) + { + afterFinish(canvas); + if(errorCallback) errorCallback(error); + }); }).catch(function(error) { afterFinish();