]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
Braille: In vectortopdf check inkscape version to call inkscape with the correct...
authorTinyTrebuchet <73381089+TinyTrebuchet@users.noreply.github.com>
Sat, 15 Jan 2022 14:35:32 +0000 (20:05 +0530)
committerGitHub <noreply@github.com>
Sat, 15 Jan 2022 14:35:32 +0000 (15:35 +0100)
From version 1.0.x on, Inkscape does not support the '-A' command line flag any more. Now we check the inkscape version and call inkscape always with the correct command line.

filter/braille/filters/vectortopdf.in

index df0df0abc3249fae3a9c2bd3b5d9a137d74ee426..6e568c3fe8ad1751ad35593e9579d5bcf32b22df 100644 (file)
@@ -59,11 +59,24 @@ fi
 
 checkTool inkscape inkscape "embossing ${INPUT_FORMAT} vector images"
 
-INKSCAPE="inkscape -z --export-area-drawing"
+INKSCAPE="inkscape --export-area-drawing"
 
 echo "INFO: Converting image" 1>&2
 printf "DEBUG: Calling $INKSCAPE on '%s'\n" "$FILE_FORMAT" 1>&2
-$INKSCAPE -A "$FILE_PDF" "$FILE_FORMAT"
+
+CURR_VERSION=$(inkscape --version | awk '{print $2}')
+NEW_VERSION='1.0'
+
+printf "DEBUG: Inkscape version: '%s'\n" "$CURR_VERSION" 1>&2
+
+# Inkscape versions 1.0.x and greater do not support '-A' flag
+
+if [ $(printf '%s\n' "$NEW_VERSION" "$CURR_VERSION" | sort -V | head -n1) = "$NEW_VERSION" ]; then
+       $INKSCAPE --export-type=pdf --export-filename="$FILE_PDF" "$FILE_FORMAT"
+else
+       $INSCKAPE -z -A "$FILE_PDF" "$FILE_FORMAT"
+fi
+
 cat "$FILE_PDF"
 
 echo "INFO: Ready" >&2