Learn R Programming

cardargus (version 0.2.0)

save_svg: Save SVG string to file (sanitized + embedded fonts)

Description

Saves an SVG string to disk. Before saving, the function:

  1. sanitizes the SVG to remove problematic Inkscape/Sodipodi metadata that can break strict XML parsers, and

  2. detects and embeds fonts (WOFF2 via @font-face) for deterministic rendering.

This function expects the font helpers to be available in the package: detect_svg_fonts(), ensure_cardargus_fonts(), and embed_svg_fonts().

Usage

save_svg(svg_content, output_path)

Value

Path to the saved SVG file.

Arguments

svg_content

SVG string (or object coercible to character).

output_path

Output file path.

Examples

Run this code
svg <- svg_card("FAR", list(), list())
save_svg(svg, tempfile(fileext = ".svg"))

Run the code above in your browser using DataLab