# info > DVILJ

---
type: CommandReference
command: dvilj, dvilj4, dvilj4l, dvilj2p
mode: man
section: 1
source: man-pages
---

## Quick Reference

- `dvilj file.dvi` — convert DVI to PCL (output file.lj)
- `dvilj -e- file.dvi` — output to stdout
- `dvilj -c2 file.dvi` — print 2 copies
- `dvilj -d1 file.dvi` — duplex long-edge binding
- `dvilj -D file.dvi` — double-page printing (even then odd pages)
- `dvilj -l file.dvi` — landscape mode
- `dvilj -s26 file.dvi` — A4 paper size
- `dvilj -p20 file.dvi` — print 20 pages

## Name

dvilj and siblings (dvilj4, dvilj4l, dvilj2p) — convert a TeX DVI file to PCL, for HP LaserJet printers

## Synopsis

`dvilj [options] [filename]`

## Options

### General Options

- `-cnumber` — Print each page `number` times (including original).
- `-E` — Switch printer into econo mode (dvilj4 only).
- `-eoutfile` — Send output to `outfile` instead of default `.lj` extension. Use `-e-` for stdout.
- `-g` — Go mode: do not reset printer at start of job.
- `-hheaderfile` — Copy `headerfile` to output before translation (send arbitrary PCL commands).
- `-Mflag` — Do (not) call `mktexpk` to generate fonts on demand. `-M1` enables, `-M0` disables. Default is enabled.
- `-q` — Quiet operation (omit final statistics).
- `-r` — Toggle page reversal.
- `-v` — Verbose mode (list fonts used).
- `-w` — Omit warnings.
- `-z` — Print a test page with the page counter at end of job.
- `--Dnumber` — Debug according to bits of `number` (see kpathsea). Also turns on verbosity.

### Duplex and Double-Page Options

- `-dnumber` — Duplex mode: `-d1` for long edge binding, `-d2` for short edge binding. Only in dvilj4 and dvilj2p.
- `-D[-12]` — Double-sided printing: `-D` prints both sides (manual feed after first half). `-D1` for odd pages only, `-D2` for even pages. A trailing `-` suppresses empty padding pages.

### Page Selection and Magnification

- `-fpagenum` — Print pages with TeX page numbers >= `pagenum`.
- `-ppagecount` — Print `pagecount` pages after the starting page.
- `-tpagenum` — Print pages with TeX page numbers <= `pagenum`.
- `-mmagnification` — Specify magnification. Available: `-m#usermag` (e.g., `#900`), `-m0` (1000), `-mh` (1095), `-m1` (1200), `-mq` (1250), `-m2` (1440), `-m3` (1728), `-m4` (2074), `-m5` (2488).

### Page Size

- `-spagesize` — Specify page size. Common values: `-s2` Letter, `-s3` Legal, `-s6` Ledger, `-s26` A4, `-s27` A3, `-s25` A5, `-s45` JIS B5, `-s46` JIS B4, `-s80` Monarch Envelope, `-s81` Commercial Envelope 10, `-s90` DL, `-s91` C5, `-s100` International B5. If omitted, no clipping at bottom.

### Offset and Orientation

- `-l` — Landscape mode (dvilj2p and dvilj4 only).
- `-xoffset(mm)` — Global x-offset in mm relative to 1in/1in origin.
- `-yoffset(mm)` — Global y-offset in mm.
- `-Xoffset(dots)` — Global x-offset in dots (overrides 1in/1in origin).
- `-Yoffset(dots)` — Global y-offset in dots.
- `-Vmode` — Compatibility mode: `K` for Kyocera, `B` for Brother, `6` for LJ6.

### TeX \special Commands

Supported `\special` commands have the generic syntax:

`\special{key=value key="value with space"}`

Values can be space-separated or quoted (single or double). Spaces around `=` are ignored.

- `hpfile=file` — Insert `file` at current position, with absolute positioning rewritten to relative. File searched via `DVILJINPUTS` and `TEXINPUTS`.
- `hpfile_verbatim=file` — Insert `file` verbatim (no rewriting).
- `psfile=file llx=x0 lly=y0 urx=x1 ury=y1 rwi=s` — Convert PostScript file to PCL via Ghostscript (device `ljetplus`), insert at current position. Mandatory integer parameters: `llx`, `lly`, `urx`, `ury`, `rwi`. Semantics not fully documented.
- `dvilj-psfile-syntax=syntax` — Control psfile processing: `dvilj` (process) or `ignore` (skip). Only affects subsequent psfile specials on the same page.
- `comment=arbitrary text` or `comment arbitrary text` — Ignore rest of special. Used for meta-information.
- `orientation=po` — Position page: 0 portrait, 1 landscape, 2 reverse portrait, 3 reverse landscape.
- `defpoint=n(x,y)` — Define point `n` (0-79) at coordinates `x,y` (relative to DVI page origin, in points). If `x,y` omitted, current page position is used.
- `resetpoints="all"` — Undefine all points.
- `gray=gray_scale` or `grey=gray_scale` — Set fill mode to gray percentage (0-100). Only 8 distinct patterns: 1-2%, 3-10%, 11-20%, 21-35%, 36-55%, 56-80%, 81-99%, 100%.
- `pattern=pat` — Set fill mode to pattern: 1 horizontal, 2 vertical, 3 diagonal (lower-left to upper-right), 4 diagonal (upper-left to lower-right), 5 crossed vertical, 6 crossed diagonal.
- `fill=a/b` — Fill rectangle between points `a` (upper-left) and `b` (lower-right) using current fill mode. Default is 10% gray.
- `filename` — Legacy: if special is a single word naming an existing file, include it verbatim (not searched via kpathsea). Deprecated.

### Environment Variables

- `DVILJFONTS` — Overrides all other font paths.
- `DVILJMAKEPK` — Overrides `mktexpk` as the command to create PK fonts.
- `DVILJSIZES` — Colon-separated list of available font sizes (in dpi). If begins with `:`, system default sizes are included.
- `DVILJINPUTS` — Primary search path for include files.
- `TEXINPUTS` — Secondary search path for include files.
- `TEX_HUSH` — Colon-separated identifiers to suppress warnings: `checksum`, `readable`, `special`, `all`, `none`.
- `KPATHSEA_DEBUG` — Trace kpathsea lookups; set to `-1` for complete tracing.
- `GS_PATH` — On Windows, path to Ghostscript (default `gswin32c.exe`). On Unix, `gs` must be on `$PATH`.

### Double Page Printing Details

When `-D` is used without optional number, after printing even pages the printer stops with "FEED" message. Manual feed or continue button resumes. The driver handles odd/even page counts intelligently: inserts empty pages when needed (e.g., if document starts with page 0, an empty page is inserted after page 0). The `-D` option works for all LJ printers, not just duplex models.

## Examples

shell
# Convert to PCL, output to file.lj
dvilj mydoc.dvi

# Output to stdout
dvilj -e- mydoc.dvi

# Two copies
dvilj -c2 mydoc.dvi

# Duplex long-edge binding
dvilj -d1 mydoc.dvi

# Double-page printing (manual feed)
dvilj -D mydoc.dvi

# Landscape mode
dvilj -l mydoc.dvi

# A4 paper size
dvilj -s26 mydoc.dvi

# Print first 20 pages
dvilj -p20 mydoc.dvi
## See Also

[dvihp(1)](http://localhost/phpMan.php/man/dvihp/1/markdown), [dvicopy(1)](http://localhost/phpMan.php/man/dvicopy/1/markdown), [dvips(1)](http://localhost/phpMan.php/man/dvips/1/markdown), [xdvi(1)](http://localhost/phpMan.php/man/xdvi/1/markdown), [mktexpk(1)](http://localhost/phpMan.php/man/mktexpk/1/markdown), [gs(1)](http://localhost/phpMan.php/man/gs/1/markdown), [kpathsea(3)](http://localhost/phpMan.php/man/kpathsea/3/markdown)

Report bugs to <tex-k@tug.org>. Source: <http://mirror.ctan.org/dviware/dviljk/>.