Skip to content

Commit

Permalink
Add margin around preview
Browse files Browse the repository at this point in the history
  • Loading branch information
slideclimb committed May 9, 2020
1 parent 67e740b commit a3e271d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/nl/hannahsten/texifyidea/ui/PreviewFormUpdater.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -121,7 +121,6 @@ $previewCode
runCommand(
inkscapeExecutable(),
arrayOf("$tempBasename.pdf",
"--export-area-drawing",
"--export-dpi", "1000",
"--export-background", "#FFFFFF",
"--export-background-opacity", "1.0",
Expand All @@ -143,7 +142,6 @@ $previewCode
runCommand(
inkscapeExecutable(),
arrayOf("$tempBasename.svg",
"--export-area-drawing",
"--export-dpi", "1000",
"--export-background", "#FFFFFF",
"--export-png", "$tempBasename.png"
Expand Down
8 changes: 4 additions & 4 deletions src/nl/hannahsten/texifyidea/util/SystemEnvironment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand All @@ -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) {
Expand Down

0 comments on commit a3e271d

Please sign in to comment.