pdfTeX is the TeX engine that produces PDF directly, with no DVI step in between. It is what pdflatex actually runs, and for years the most widely used TeX engine in the world. Its signature feature is *micro-typography*: margin kerning, which lets characters at the edges of a line protrude slightly past the text block, and font expansion, which stretches or shrinks glyph widths almost imperceptibly. These are what make pdfTeX special on the axis of typographic quality.
What pdfTeX is
Knuth's original TeX only emits an intermediate format called DVI (device independent), which a separate program then converts to PostScript or PDF. pdfTeX removes a step from that pipeline and generates PDF directly from TeX's page-builder. It was written in the late 1990s by Hàn Thế Thành, originally from Vietnam, as part of his PhD work at Masaryk University in the Czech Republic. The first public release was in 1996.
The key thing to keep straight is that pdfTeX is an engine, not a format. The engine is the executable that does the work; the format is the system of commands (LaTeX, Plain TeX). The pdfTeX engine running the LaTeX format gives you pdfLaTeX (the command pdflatex); running Plain TeX gives you pdftex. When you say you are "writing in pdfLaTeX," pdfTeX is the engine underneath.
pdfTeX incorporates the e-TeX extensions. e-TeX is a set of additions to TeX's macro machinery — \protected, \unexpanded, more registers, right-to-left typesetting support, and more — that modern LaTeX takes for granted. Historically the e-TeX-enabled pdfTeX shipped as pdfetex and became the default engine from TeX Live 2004. You can safely think of today's pdflatex as pdfTeX-with-e-TeX.
PDF output, or still DVI
By default it produces PDF directly, but pdfTeX can still emit DVI. The switch is the integer parameter \pdfoutput: set \pdfoutput=1 (any positive value) for PDF, or \pdfoutput=0 to fall back to classic DVI. The DVI produced with \pdfoutput=0 is, in principle, identical to what the original TeX would have emitted.
This value must be set very early — before \documentclass, in the opening preamble (you cannot flip between PDF and DVI mid-document). Some packages that rely on PostScript specials, such as PSTricks, sometimes need the DVI→PS→PDF route, and that is where \pdfoutput=0 earns its keep.
% Force DVI output even when run via pdflatex
\pdfoutput=0
\documentclass{article}
\begin{document}
This run produces a .dvi file, not a .pdf.
\end{document}Micro-typography
No account of pdfTeX is complete without micro-typography. This was the very subject of Hàn Thế Thành's PhD thesis, *Micro-typographic extensions to the TeX typesetting system* — a set of subtle adjustments, woven into TeX's line-breaking algorithm, that smooth the edge of the text block and even out the spacing within a line. The idea traces back to the hz-program developed by Hermann Zapf and Peter Karow.
The first is character protrusion, also called margin kerning. By letting periods, commas, hyphens, and punctuation hang just slightly past the edge of the text block, a margin that looks ragged under purely mechanical justification appears optically straight. It is a generalization of the old practice of hanging punctuation.
The second is font expansion, the hz-algorithm. By using glyph shapes stretched or shrunk horizontally by an imperceptibly small amount, interword spacing can be made more even. pdfTeX folds this room-to-flex into the line-breaking decision itself, choosing better breakpoints. The result is fewer lines with gaping word spaces (the so-called "rivers") and a more uniform overall texture to the paragraph.
These can be driven with raw primitives. Protrusion uses \pdfprotrudechars (0 = off, 1 = on, 2 = also reflected in width computations) together with \lpcode (left edge) and \rpcode (right edge), which set the per-character amount. Font expansion uses \pdfadjustspacing (=2 integrates the stretch into line-breaking) together with \efcode, which sets each character's willingness to stretch. In practice you almost never touch these directly.
In real documents you simply load the microtype package, which wraps all of this and picks sensible defaults for you. A single line — \usepackage{microtype} — turns on protrusion and font expansion with good settings.
\documentclass{article}
\usepackage{microtype} % protrusion + expansion, sensible defaults
\begin{document}
With microtype loaded, pdfTeX nudges punctuation into the
margins and flexes glyph widths a hair, so justified text
looks noticeably more even.
\end{document}PDF features and image inclusion
Because it builds PDF directly, pdfTeX exposes primitives that reach into PDF features. The headline ones are \pdfliteral, which injects raw PDF drawing operators; \pdfobj, which creates a PDF object directly; and \pdfannot, which places an annotation (a link, a form field, and so on). Hyperlinks and bookmarks are built on top of these mechanisms by the hyperref package.
For document-wide settings there are \pdfinfo, which writes metadata such as the title and author; \pdfcompresslevel, which sets how hard the output PDF is compressed; and \pdfpageattr, which attaches attributes to every page.
\pdfinfo{
/Title (My Report)
/Author (A. Author)
}
\pdfcompresslevel=9
% draw a thin rule with a raw PDF operator
\pdfliteral{0 0 m 100 0 l 0.4 w S}Images work directly too. A strength of pdfTeX is that it can include PNG, JPEG, and PDF with no intermediate conversion (EPS, by contrast, must be converted to PDF first); at the low level, \pdfximage reads an image in. Normally, though, you just use \includegraphics from the graphicx package, which calls the right primitives for you.
| Primitive | What it does |
|---|---|
\pdfliteral | Insert raw PDF drawing operators |
\pdfobj / \pdfannot | Create a PDF object / annotation directly |
\pdfinfo | Write metadata (title, author, …) |
\pdfcompresslevel | Output PDF compression level (0–9) |
\pdfximage | Include a PNG / JPEG / PDF image |
\pdfpageattr | Attach PDF attributes to each page |
Limits, and when to switch
For all its power, pdfTeX carries constraints that feel dated today. The biggest is that it is an 8-bit engine. It has no built-in machinery for taking Unicode as input the way XeTeX and LuaTeX do, and it is not designed to typeset, say, Japanese UTF-8 directly (for Western text this was patched over with inputenc/fontenc).
Font handling is limited too. Metrics depend on TFM (TeX Font Metric) files, and the actual glyphs are embedded from Type1 or TrueType fonts via map files. You cannot simply name an OpenType font installed on the operating system and have it used. And there is no embedded scripting language such as Lua to run programs during typesetting.
This is exactly why the desire to use system fonts or to typeset many languages in Unicode pushes people toward XeTeX or LuaTeX. If you are starting fresh — and especially for Japanese — those engines (upLaTeX or LuaLaTeX for Japanese) are the practical choice.
pdfTeX itself is now in a stable, more or less frozen maintenance mode. Bug fixes continue, but new development has largely moved to LuaTeX (a successor that embeds Lua into pdfTeX). Even so, for mostly-English and European-language documents, pdfTeX remains fast, dependable, and the most battle-tested choice there is.
A legacy of primitives
The many \pdf... primitives that pdfTeX introduced were carried forward into later engines and became a de facto standard. The micro-typographic features, for instance, were adopted into both XeTeX and LuaTeX.
In LuaTeX, however, the sprawling \pdf... namespace was cleaned up and much of it folded into a small set of gateways — **\pdfextension, \pdfvariable, and \pdffeedback**. For example, \pdfliteral becomes \pdfextension literal, and \pdfoutput becomes \outputmode. Your pdfTeX-era knowledge mostly carries over, but it is worth remembering that the spelling changes on the newer engine.