Kos Ivantsov
6 supporters
Live Preview in OmegaT

Live Preview in OmegaT

Jan 13, 2022

A few days ago I shared a bash script for Linux which can be launched as an OmegaT post-processing command, to covert the current target file into PDF and open in Zathura, a very lightweight PDF viewer that automatically refreshes the view whenever the viewed file is changed.
Great, but limited only to Linux, and works only with LibreOffice for conversion.

Now I've got an idea how to rewrite it in Groovy and make it crossplatform. So far I managed:

  • The script runs on Linux, Windows and MacOS

  • If the file is supported, it launches LO and converts it to PDF

  • The target file can either be copied or symlinked to a temp location for conversion (symlinks might be better for big files or slow media)

  • The script echos LO's output and possible errors to the scripting console

Now I'm planning:

  • Make the script open the converted PDF in the default viewer, but only once, without spawning it each time it's invoked

  • Add MS Office and Abiword as converters

  • Pass the current file to the default browser if it's (X)HTML

  • Check for tag errors before doing anything else (to avoid attempting to convert possibly invalid target files)

In the long run it might be a good idea to wrap it all into a plugin of some sort, but it will take a lot of time, as my Java level is far from being adequate for the task.

Enjoy this post?

Buy Kos Ivantsov a coffee

More from Kos Ivantsov