fix(ui): fix bugreport pdf gen
This commit is contained in:
parent
e96e84b98d
commit
757d2ca77a
1 changed files with 7 additions and 9 deletions
|
|
@ -119,21 +119,20 @@ function BugReportModal({ hideModal, session, width, height, account, xrayProps,
|
|||
}).then((canvas) => {
|
||||
const imgData = canvas.toDataURL('img/png');
|
||||
|
||||
var imgWidth = 200;
|
||||
var pageHeight = 295;
|
||||
var imgHeight = (canvas.height * imgWidth) / canvas.width;
|
||||
var heightLeft = imgHeight;
|
||||
var position = 0;
|
||||
let imgWidth = 200;
|
||||
let pageHeight = 295;
|
||||
let imgHeight = (canvas.height * imgWidth) / canvas.width;
|
||||
let heightLeft = imgHeight - pageHeight;
|
||||
let position = 0;
|
||||
|
||||
|
||||
doc.addImage(imgData, 'PNG', 5, 5, imgWidth, imgHeight);
|
||||
|
||||
doc.addImage('/assets/img/report-head.png', 'png', 210/2 - 40/2, 2, 45, 5);
|
||||
|
||||
heightLeft -= pageHeight - 7;
|
||||
if (position === 0 && heightLeft === 0) doc.addImage('/assets/img/report-head.png', 'png', 210/2 - 40/2, pageHeight - 5, 45, 5);
|
||||
|
||||
while (heightLeft >= 0) {
|
||||
position = heightLeft - imgHeight + 10;
|
||||
position = heightLeft - imgHeight;
|
||||
doc.addPage();
|
||||
doc.addImage(imgData, 'PNG', 5, position, imgWidth, imgHeight);
|
||||
doc.addImage('/assets/img/report-head.png', 'png', 210/2 - 40/2, pageHeight - 5, 45, 5);
|
||||
|
|
@ -141,7 +140,6 @@ function BugReportModal({ hideModal, session, width, height, account, xrayProps,
|
|||
}
|
||||
|
||||
doc.link(5, 295 - Math.abs(heightLeft) - 25, 200, 30, { url: sessionUrl });
|
||||
if (position === 0) doc.addImage('/assets/img/report-head.png', 'png', 210/2 - 40/2, pageHeight - 5, 45, 5);
|
||||
|
||||
doc.save('Bug Report: ' + sessionId + '.pdf');
|
||||
setRendering(false);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue