Inspired by Ruby dvilib library
- https://ctan.org/pkg/dvistd
man
pages ofdv2dt
- dvitype - translate a dvi file for humans
- dviasm - python script to assamble/disassamble dvi file
- dv2dt - convert a binary TeX DVI file into text representation.
local dvi = require("dvi")
local dvi_lua_table = dvi.parse(io.open("foo.dvi", 'rb'))
dvi.dump(open("out.dvi", 'wb'), dvi_lua_table)
local inspect = require("inspect") -- $ luarocks install inspect
local dvi = require("dvi")
local dvifilein = arg[1]
local fh = assert(io.open(dvifilein, 'rb'))
local contents = dvi.parse(fh) -- parse Dvi file into table
print(inspect(contents)) -- Inspect lua table
local dvifileout = 'out.dvi'
local fout = assert(io.open(dvifileout, 'wb'))
dvi.dump(fout, contents) -- write table to DVI file
print("Output written to " .. dvifileout)