diff --git a/src/nl/hannahsten/texifyidea/ui/PreviewFormUpdater.kt b/src/nl/hannahsten/texifyidea/ui/PreviewFormUpdater.kt index 6aa455aab..01e9bdb90 100644 --- a/src/nl/hannahsten/texifyidea/ui/PreviewFormUpdater.kt +++ b/src/nl/hannahsten/texifyidea/ui/PreviewFormUpdater.kt @@ -61,7 +61,7 @@ class PreviewFormUpdater(private val previewForm: PreviewForm) { val tempBasename = Paths.get(tempDirectory.path.toString(), "temp").toString() val writer = PrintWriter("$tempBasename.tex", "UTF-8") - val tmpContent = """\documentclass{article} + val tmpContent = """\documentclass[border=1mm]{standalone} $preamble \begin{document} @@ -121,7 +121,6 @@ $previewCode runCommand( inkscapeExecutable(), arrayOf("$tempBasename.pdf", - "--export-area-drawing", "--export-dpi", "1000", "--export-background", "#FFFFFF", "--export-background-opacity", "1.0", @@ -143,7 +142,6 @@ $previewCode runCommand( inkscapeExecutable(), arrayOf("$tempBasename.svg", - "--export-area-drawing", "--export-dpi", "1000", "--export-background", "#FFFFFF", "--export-png", "$tempBasename.png" diff --git a/src/nl/hannahsten/texifyidea/util/SystemEnvironment.kt b/src/nl/hannahsten/texifyidea/util/SystemEnvironment.kt index 3a85200d5..711b39bd7 100644 --- a/src/nl/hannahsten/texifyidea/util/SystemEnvironment.kt +++ b/src/nl/hannahsten/texifyidea/util/SystemEnvironment.kt @@ -11,14 +11,14 @@ class SystemEnvironment { companion object { val inkscapeMajorVersion: Int by lazy { - runCommand("inkscape", "--version") - .split(" ").getOrNull(1) + "inkscape --version".runCommand() + ?.split(" ")?.getOrNull(1) ?.split(".")?.firstOrNull() ?.toInt() ?: 0 } val isInkscapeInstalledAsSnap: Boolean by lazy { - runCommand("snap", "list").contains("inkscape") + "snap list".runCommand()?.contains("inkscape") == true } } @@ -34,7 +34,7 @@ internal fun runCommand(vararg commands: String): String { .start() // Timeout value - proc.waitFor(10, TimeUnit.SECONDS) + proc.waitFor(3, TimeUnit.SECONDS) return proc.inputStream.bufferedReader().readText() } catch (e: IOException) {