* [perf story #59018] Export to pdf for gantt wg.

This commit is contained in:
wangyidong
2024-07-15 10:04:18 +08:00
committed by 谢杞钰
parent b072ea89dd
commit e0fa784e61
+20
View File
@@ -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();