Main class for embedding files into SVGs.
generator = SVGGenerator(
compression=False, # Enable compression
overwrite=False, # Overwrite existing files
verbose=False # Show progress information
)
embed(svg_file, files, output, **kwargs)
Embed files into an SVG.
Parameters:
svg_file
(str): Path to SVG templatefiles
(str/list): File(s) to embed (path or list of paths)output
(str): Output file path**kwargs
: Additional options
metadata
(dict): Document metadatacompression
(bool): Enable compressiontemplate_vars
(dict): Template variablesReturns:
Result
object with success status and details
embed_directory(svg_file, directory, output, **kwargs)
Embed all matching files from a directory.
Parameters:
directory
(str): Directory pathpattern
(str): File pattern (default: “.”)recursive
(bool): Include subdirectoriesembed()
from_string(svg_content, files, **kwargs)
Create SVG from string content.
Parameters:
svg_content
(str): SVG content as stringembed()
Utility for extracting embedded files from SVGs.
extract(svg_file, output_dir, pattern='*')
Extract embedded files.
Parameters:
svg_file
(str): Path to SVG fileoutput_dir
(str): Output directorypattern
(str): File pattern to matchReturns:
Result
object with list of extracted files
list_files(svg_file)
List embedded files without extracting.
Returns: List of embedded file information
get_metadata(svg_file)
Get metadata from SVG.
Returns: Dictionary of metadata