File size: 471 Bytes
320fd56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)
        print(f"Successfully converted SVG to PDF: {pdf_path}")
    except Exception as e:
        print(f"Error converting SVG to PDF: {e}")