pyabc2.abcjs.headless.svg_to

pyabc2.abcjs.headless.svg_to(svg, fmt, **kwargs)

Convert an SVG string to another format, returning bytes.

Parameters:
  • svg (str) – The SVG string to convert.

  • fmt (str) – The format to convert to, e.g., ‘png’, ‘pdf’, ‘ps’, ‘svg’.

  • **kwargs

    Passed to the cairosvg function. Options include:

    • scale

    • dpi

    • parent_width, parent_height (for SVGs using percentages)

    • output_width, output_height

Return type:

bytes