Hi,
I noticed that the barcode generated will go beyond the container size, even I've set the width and height for the container. I believe this is also been raised by one of the users from our community.
by José Torrão
2019-03-11
in version 2.0.0
You should set on CSS that the canvas has a max-width and max-height of 100%, I was having problems with screen sizes because the barcode was going outside of my container (because the canvas max-width and max-height weren't defined).
Is there anything that I can do to limit the size of the barcode generated? I've tried to add the code :document.getElementById($parameters.PlaceholderId).style.maxWidth = "100px"; inside the InitCanvas and it doesn't work. I've also briefly looked into the JsBarcode library and saw there's one line of code :
var r={width:2,height:100,
format:"auto",displayValue:!0,fontOptions:"",font:"monospace",text:void 0,textAlign:"center",textPosition:"bottom",textMargin:2,fontSize:20,background:"#ffffff",lineColor:"#000000",margin:10,marginTop:void 0,marginBottom:void 0,marginLeft:void 0,marginRight:void 0,valid:function()
Is the "void 0" the one that we can change to adjust the size of the barcode? If not, where can we set the max-width and max-height for the barcode?
Kenny
Solved through identifying the id of the canvas through custom CSS:#canvas {
width : 100%;
}
In case who might need it in the future. Thanks.
Regards,