* [perf story #59018] Export to pdf for gantt wg.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user