SathvikGanta's picture
Update svg_to_pdf.py
b61fcfd verified
raw
history blame contribute delete
422 Bytes
import cairosvg
def convert_svg_to_pdf(svg_path, pdf_path):
"""
Converts an SVG file to a PDF while preserving vector data.
Args:
svg_path (str): Path to the input SVG file.
pdf_path (str): Path to save the output PDF file.
"""
try:
cairosvg.svg2pdf(url=svg_path, write_to=pdf_path)
except Exception as e:
raise ValueError(f"Error converting SVG to PDF: {str(e)}")