You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are experiencing an issue when exporting long survey reports. A black box appears at the bottom of the PDF. After investigation, we found that this occurs when exporting images in the canvas using html2canvas. When cropping the image, it generates a black block.
We realized that the image needs to be in PNG format instead of JPG to avoid this problem. Here are the changes we made in the main/survey/reporting.php file:
Changes Made
Before:
var pageData = canvas.toDataURL("image/jpeg", 1);
pdf.addImage(pageData, "JPEG", 35, 60, 515, headerY);
var pageData = canvas.toDataURL("image/jpeg", 0.7);
pdf.addImage(pageData, "JPEG", 40, positionY + 180, 500, 500 / canvas.width * canvas.height);
var sectionImgData = sectionCanvas.toDataURL("image/jpeg", 0.7);
pdf.addImage(sectionImgData, "JPEG", 40, y, imgWidth, heightToDraw);
After:
var pageData = canvas.toDataURL("image/png", 1);
pdf.addImage(pageData, "PNG", 35, 60, 515, headerY);
var pageData = canvas.toDataURL("image/png", 0.7);
pdf.addImage(pageData, "PNG", 40, positionY + 180, 500, 500 / canvas.width * canvas.height);
var sectionImgData = sectionCanvas.toDataURL("image/png", 0.7);
pdf.addImage(sectionImgData, "PNG", 40, y, imgWidth, heightToDraw);
These changes should resolve the issue of black boxes appearing in the PDFs.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Good morning,
We are experiencing an issue when exporting long survey reports. A black box appears at the bottom of the PDF. After investigation, we found that this occurs when exporting images in the canvas using html2canvas. When cropping the image, it generates a black block.
We realized that the image needs to be in PNG format instead of JPG to avoid this problem. Here are the changes we made in the main/survey/reporting.php file:
Changes Made
Before:
After:
These changes should resolve the issue of black boxes appearing in the PDFs.
Thank you for your assistance.
Sincerely,
Beta Was this translation helpful? Give feedback.
All reactions