Last active
August 29, 2015 14:03
-
-
Save cmawhorter/c10cf2e9fd46e0b9fde3 to your computer and use it in GitHub Desktop.
Converts all (vector) files in a directory to svg using ps2pdf, uniconvertor and inkscape.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM This will fail with "the input line is too long" if you have a lot of files... maybe? | |
REM Don't know why, but I think the solution is breaking the body of the for () into a separate | |
REM batch. But... IDGAF. | |
echo Starting... | |
for %%i in (*.*) do ( | |
echo Looking at... %%~di%%~pi%%~ni%%~xi | |
IF "%%~xi"==".svg" ( | |
echo Skipping. Already an svg. | |
) else ( | |
if exist "C:\svgconversions\%%~ni.svg" ( | |
echo Noooope. Already converted. | |
) else ( | |
IF "%%~xi"==".eps" ( | |
echo Processing eps... | |
ps2pdf "%%~di%%~pi%%~ni%%~xi" C:\svgconversions\%%~ni.pdf | |
inkscape C:\svgconversions\%%~ni.pdf --export-plain-svg=C:\svgconversions\%%~ni.svg | |
del C:\svgconversions\%%~ni.pdf | |
REM inkscape --verb=EditSelectAll --verb=ObjectSetClipPath --verb=FileSave --verb=FileClose $svg_file_name | |
) ELSE ( | |
echo Processing other... | |
uniconvertor "%%~di%%~pi%%~ni%%~xi" C:\svgconversions\%%~ni.svg | |
REM for some reason this needs to run twice here | |
inkscape --verb=FitCanvasToDrawing --verb=FileSave --verb=FileClose C:\svgconversions\%%~ni.svg | |
) | |
inkscape --verb=FitCanvasToDrawing --verb=FileSave --verb=FileClose C:\svgconversions\%%~ni.svg | |
echo Processed. | |
) | |
) | |
echo. | |
) | |
echo Done. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment