#latex #tex #dvi

bin+lib dvi-to-text

dvi-to-text is a small tool converting a DVI file (output from TeX/LaTeX) to a string representation of the text contained in the document

3 unstable releases

0.2.1 Nov 19, 2022
0.2.0 Nov 14, 2022
0.1.0 Nov 11, 2022

#1768 in Command line utilities

MIT license

195 lines

DVI to Text

Converts a DVI file (as output from TeX/LaTeX) to a slice of bytes representing what might be the text displayed in the document. DVI files have no concept of Unicode; each character command draws a character (value 0 to 255) in a certain font, including fonts that might not have an ASCII subset. This tool discards the font information.

The tool inserts newline bytes 0x0A for vertical spaces and page breaks, and space bytes 0x20 for horizontal spaces between characters. Newline and space bytes are inserted proportional to the length of spaces.

Includes a command-line interface to output to stdout. Example usage:

dvi-to-text tests/abc.dvi


~17K SLoC