generate_svg: Generate the QR code as an svg file

View source: R/generate_svg.R

generate_svgR Documentation

Generate the QR code as an svg file

Description

Create the QR code using qr_code() and save it as an svg file.

Usage

generate_svg(
  qrcode,
  filename,
  size = 300,
  foreground = "black",
  background = "white",
  show = interactive(),
  ...
)

## Default S3 method:
generate_svg(
  qrcode,
  filename,
  size = 300,
  foreground = "black",
  background = "white",
  show = interactive(),
  ...
)

## S3 method for class 'qr_code'
generate_svg(
  qrcode,
  filename,
  size = 300,
  foreground = "black",
  background = "white",
  show = interactive(),
  ...
)

## S3 method for class 'qr_wifi'
generate_svg(
  qrcode,
  filename,
  size = 300,
  foreground = "black",
  background = "white",
  show = interactive(),
  ...,
  fontsize = 15
)

## S3 method for class 'qr_logo'
generate_svg(
  qrcode,
  filename,
  size = 300,
  foreground = "black",
  background = "white",
  show = interactive(),
  ...
)

Arguments

qrcode

a qr_code object as generated by qr_code.

filename

Where to store the QR code as svg file. Silently overwrites existing files. Tries to create the path, when it doesn't exist.

size

width of the svg file in pixels. Defaults to 300.

foreground

Stroke and fill colour for the foreground. Use a valid CSS colour. Defaults to "black".

background

Fill colour for the background. Use a valid CSS colour. Defaults to "white".

show

Open the file after creating it. Defaults to TRUE on interactive() sessions, otherwise FALSE.

...

Currently ignored.

fontsize

The size of the font in pixels.

Value

invisible NULL

Author(s)

Thierry Onkelinx

See Also

Other qr: coordinates(), plot.qr_code(), print.qr_code(), qr_code(), qr_event(), qr_wifi()

Examples

code <- qr_code("HELLO WORLD")
generate_svg(
  qrcode = code, filename = tempfile(fileext = ".svg"), show = FALSE
)

qrcode documentation built on Nov. 11, 2023, 5:07 p.m.