Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to display checkbox and radiobuttons and with html2canvas? Rest all is rendering correctly..only problem with checkboxes and radiobuttons.
Posted

1 solution

In html2canvas.js plase make the following changes.

After case "INPUT":

if (/^(text|url|email|submit|button|reset|checkbox|radio)$/.test(element.type) && (element.value || element.placeholder || "" ).length > 0) {
renderFormValue(element, bounds, stack);
}

After el.nodeName === "SELECT"

if (el.type == 'checkbox' || el.type == 'radio'){
valueWrap.style.fontSize = '10px';
valueWrap.style.lineHeight = '10px';
renderRect(stack.ctx, bounds.left-2, bounds.top-1, 13, 13, "#888888");
renderRect(stack.ctx, bounds.left-1, bounds.top, 11, 11, "#dddddd");
if(el.type == 'checkbox'){
textValue = (el.checked) ? "✔" : " ";
}
else if (el.type == 'radio'){
textValue = (el.checked) ? "●"; : " ";
}
 
Share this answer
 
Comments
Is this the answer?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900