whomwah/rqrcode

How to set width and height of generated svg

collimarco opened this issue · 1 comments

How can you set the width and height attributes?

I can't find any option in the readme.

This is useful if you use the svg directly in the html (without an img tag).

Hi @collimarco,

You can use the svg_attributes option as part of as_svg to either give the svg an id/class or set the width or height. Some examples:

qrcode.as_svg(
  ...
  svg_attributes: {
    id: "myUniqueId",
    class: "myClass"
  }
)

qrcode.as_svg(
  ...
  svg_attributes: {
    width: "200",
    height: "200"
  }
)

If this is suitable can you close the issue once you're done. Thanks.