papnkukn / qrcode-svg

A simple QR Code generator in pure JavaScript / node.js library
MIT License
451 stars 93 forks source link

Added a method to render QR Code as an Html table. #15

Open igorshmukler opened 4 years ago

jp-ed commented 2 years ago

A useful addition - especially given the current lack of support for SVG in popular email clients like Gmail (link).

One issue I notice is that it's not possible to customize the table padding. This can be done later with CSS, but to remain consistent with the SVG parameters, I would suggest a couple of edits:

// new variable
var margin = options.padding;
...
// invisible margin added to outer table HTML
const aHTML = ['<table style="border:0;border-collapse:collapse;margin:' + margin + 'px">'];

One further improvement would allow users to customize the color of the padding, since the margin property inherits from the parent element.

igorshmukler commented 2 years ago

A useful addition - especially given the current lack of support for SVG in popular email clients like Gmail (link).

One issue I notice is that it's not possible to customize the table padding. This can be done later with CSS, but to remain consistent with the SVG parameters, I would suggest a couple of edits:

// new variable
var margin = options.padding;
...
// invisible margin added to outer table HTML
const aHTML = ['<table style="border:0;border-collapse:collapse;margin:' + margin + 'px">'];

One further improvement would allow users to customize the color of the padding, since the margin property inherits from the parent element.

thank you for the suggestion. you are certainly welcome to raise a PR with the suggested enhancement against Diophant/qrcode-svg-table (https://github.com/Diophant/qrcode-svg-table).