Learn R Programming

cardargus (version 0.2.0)

load_svg_for_embed: Load and process external SVG file for embedding

Description

Reads an SVG file and processes it to be embedded inside another SVG. Removes XML declarations, adjusts dimensions, and prepares for embedding.

Usage

load_svg_for_embed(svg_path, target_height = 40, target_width = NULL)

Value

A list with svg_content, width, and height

Arguments

svg_path

Path to the SVG file

target_height

Desired height in pixels

target_width

Optional desired width (calculated from aspect ratio if NULL)

Details

This function is useful when you want to embed custom logos or icons in cards. You can pass any SVG file path to the logos, bottom_logos, or with_icon parameters of svg_card().

Examples

Run this code
if (FALSE)  # Need a external svg file
# Load a custom logo
logo <- load_svg_for_embed("/path/to/logo.svg", target_height = 40)

# Or just pass the path directly to svg_card():
svg_card(
  title = "My Card",
  logos = c("/path/to/logo1.svg", "/path/to/logo2.svg"),
  ...
)

Run the code above in your browser using DataLab