Wikipedia:WikiProject Electronics/Ps2svg.sh

  1. !/bin/sh -e
  2. you need gs-common, pstoedit and skencil to
  3. get this script working

BASENAME=$(basename "$1"; echo x) BASENAME=${BASENAME%x}

  1. Outline fonts

eps2eps -dNOCACHE "$1" "${BASENAME}".ps2svg.ps

  1. Fix bounding box

ps2epsi "${BASENAME}".ps2svg.ps "${BASENAME}".ps

rm "${BASENAME}".ps2svg.ps

  1. Convert to Sketch

pstoedit -f sk "${BASENAME}".ps "${BASENAME}".sk

  1. Convert to SVG

skconvert "${BASENAME}".sk "${BASENAME}".svg

  1. You can also make the whole thing a big long pipe and eliminate the use of tmp files.