Skip to content

toDataURL not working with "type: 'svg'" on the server #395

@mihaon

Description

@mihaon

Steps:
Execute:

console.log(await qrcode.toDataURL('I am a pony!', { type: 'svg' }))

Expected result:

data:image/svg+xml,%3Csvg%20xmlns

Actual result:

data:image/png;base64,iVBORw0K

Seems like the problem in the lib/server.js:

exports.toDataURL = function toDataURL (text, opts, cb) {
  const params = checkParams(text, opts, cb)
  const renderer = getRendererFromType(params.opts.type)
  return render(renderer.renderToDataURL, text, params)
}

Because renderer/svg.js has no renderToDataURL function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions