HomePostsQuick PDF to SVG conversion with Inkscape

Quick PDF to SVG conversion with Inkscape

Using Inkscape CLI

You can use Inkscape CLI to convert a file from PDF to SVG with the following command :

inkscape "$pdf_filename" --export-plain-svg="$svg_filename"

A helper script

On macOS Inkscape is typically installed in

/Applications/Inkscape.app/Contents/MacOS/inkscape

To automatically convert a PDF file to SVG with the same base name you can use the following script :

#!/bin/zsh

# Check if a filename is provided
if [ "$#" -ne 1 ]; then
    echo "Usage: $0 filename"
    exit 1
fi

# Get the filename without extension
filename="${1%.*}"

# Construct the SVG filename
svg_filename="${filename}.svg"

# Execute the command
/Applications/Inkscape.app/Contents/MacOS/inkscape "$1" --export-plain-svg="$svg_filename"

Quick Action on macOS

Using the Shortcuts application on macOS you can add a quick action to Finder to convert a PDF to SVG.

Create the following shortcut :

shortcuts

Add the shortcut to the Finder quick actions :

shortcuts quick action