@@ -175,25 +175,27 @@ def convert_svg_to_pdf(
175175 Raises:
176176 SVGConversionError: If SVG conversion fails, includes the backend used and cause
177177 """
178- try :
179- if backend == "inkscape" :
180- try :
181- _run_subprocess_logged (
182- [
183- "inkscape" ,
184- f"--export-filename={ pdf_path } " ,
185- str (svg_path ),
186- ]
187- )
188- except subprocess .SubprocessError as exc :
189- raise SVGConversionError (svg_path , backend , str (exc )) from exc
190- else :
191- try :
192- with open (svg_path , "rb" ) as svg_file :
193- svg2pdf (file_obj = svg_file , write_to = str (pdf_path ))
194- except Exception as exc :
195- raise SVGConversionError (svg_path , backend , str (exc )) from exc
196-
197- return pdf_path
198- except Exception as exc :
199- raise SVGConversionError (svg_path , backend , str (exc )) from exc
178+ if backend == "inkscape" :
179+ try :
180+ _run_subprocess_logged (
181+ [
182+ "inkscape" ,
183+ f"--export-filename={ pdf_path } " ,
184+ str (svg_path ),
185+ ]
186+ )
187+ except subprocess .SubprocessError as exc :
188+ raise SVGConversionError (svg_path , backend , str (exc )) from exc
189+ else :
190+ if backend != "cairosvg" :
191+ logger .warning (
192+ "Unknown svg2pdf backend: %s - falling back to cairosvg" ,
193+ backend ,
194+ )
195+ try :
196+ with open (svg_path , "rb" ) as svg_file :
197+ svg2pdf (file_obj = svg_file , write_to = str (pdf_path ))
198+ except Exception as exc :
199+ raise SVGConversionError (svg_path , backend , str (exc )) from exc
200+
201+ return pdf_path
0 commit comments