Skip to content

Commit d184aef

Browse files
When converting ".vsdx", check if the version of Inkscape is able to do.
1 parent a711606 commit d184aef

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

translators/vsd2pdf.transdef

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,27 @@ INPUT_EXTENSIONS = .vsd .vdx .vsdx
2525
OUTPUT_EXTENSIONS for pdf = .pdf
2626
OUTPUT_EXTENSIONS for eps = .eps
2727

28-
COMMAND_LINE for pdf = inkscape --without-gui --export-area-page --export-pdf "$out" "$in"
29-
COMMAND_LINE for eps = inkscape --without-gui --export-area-page --export-eps "$out" "$in"
28+
TRANSLATOR_PERL_DEPENDENCIES = version
3029

30+
TRANSLATOR_FUNCTION =<<EOL {
31+
# Check for the Inkscape version
32+
if (lc($inext) eq '.vsdx') {
33+
my @o = runCommandOrFail("inkscape", "--version");
34+
my $o = join('', @o);
35+
if ($o =~ /^Inkscape\s+([0-9a-zA-Z\._\-]+)\s+/i) {
36+
my $mandatoryVersion = version->parse("0.49");
37+
my $version = version->parse("$1");
38+
if ($version < $mandatoryVersion) {
39+
printErr("The convertion from $inext needs Inkscape $mandatoryVersion or higher.");
40+
return;
41+
}
42+
}
43+
}
44+
if ($isepsmode) {
45+
runCommandOrFail('inkscape', '--without-gui', '--export-area-page', '--export-eps', "$out", "$in");
46+
}
47+
else {
48+
runCommandOrFail('inkscape', '--without-gui', '--export-area-page', '--export-pdf', "$out", "$in");
49+
}
50+
}
51+
EOL

0 commit comments

Comments
 (0)