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
Right now it doesn't seem like there is any way to set a viewBox for the SVG render, so it makes it difficult to resize the SVG with CSS. Possibly this is my shortcoming with CSS, but I do know that it's at least a little easier if there is a viewBox on the SVG.
I added a line to the script, right in the part that defines the root svg element, shown below:
@Gazook89 I had the same/similar issue. My solution...
Use the EncodeText method to create the QrCode object.
Then use the ToGraphicsPath method to get the SVG path of the QR Code. => PATH
Then use the Size property to get the size of the QR code. => SIZE
Then, in HTML, build the svg element, placing the SIZE in the 3rd and 4th parameter of the viewBox attribute, and the PATH in a d attribute of an svgpath element.
Sorry @Gazook89. Please ignore my comment. I thought this was a different QR Code project and was referring to that project. I forgot that I was also Watching this project. My mistake. I must get more sleep. 🙄
Right now it doesn't seem like there is any way to set a viewBox for the SVG render, so it makes it difficult to resize the SVG with CSS. Possibly this is my shortcoming with CSS, but I do know that it's at least a little easier if there is a viewBox on the SVG.
I added a line to the script, right in the part that defines the root
svg
element, shown below:EasyQRCodeJS/src/canvas2svg.js
Lines 253 to 258 in e513316
And it works for me to now use CSS like this to set width/height and get proper scaling (without setting an absolute px value):
The text was updated successfully, but these errors were encountered: