Introduction
PostScript is a programming language for describing pages, introduced by Adobe in 1985. A PostScript file is a program: a printer or a viewer runs it, and the program draws text, lines and images onto each page. It made desktop publishing possible and is still understood by many laser printers, though PDF, which grew out of it, has taken over most of its uses.
Encapsulated PostScript (EPS) is a restricted form for a single picture placed inside another document.
Structure
The reference pages cover the syntax
and object types, the binary
encoding, the Document Structuring
Conventions and the operators.
PostScript is stack based: values are pushed onto a stack, and operators such as
moveto, lineto and show take their arguments from
it. Most files follow Adobe’s Document Structuring Conventions, comments starting
with %% that let software find the pages without running the program.
The first line, %!PS-Adobe-3.0, declares this. Header comments such as
%%Pages and %%BoundingBox end at %%EndComments, a
prolog defines procedures, each page starts with %%Page:, and the file
ends with %%EOF.
%!PS-Adobe-3.0
%%Pages: 1
%%BoundingBox: 0 0 595 842
%%EndComments
%%Page: 1 1
/Helvetica findfont 24 scalefont setfont
72 750 moveto
(Hello, page one) show
showpage
%%EOF
Not described
PostScript is fully documented in Adobe’s language reference. The pages cover the syntax, binary encoding, DSC comments and the operator list, not every detail.
Known, not yet covered
- Reference: the stack signature and behaviour of each operator; the operators page lists them by group with their language level.
- Reference: the keys of the
setpagedevice, halftone, shading, image and font dictionaries, and the font types. - Reference: Encapsulated PostScript is on its own page.
- Viewer: a PostScript file is recognised and named, but there is no interpreter: nothing is drawn and the program is not run.
Links
Software
- Ghostscript – PostScript interpreter that views and converts .ps files, for example to PDF (Windows, macOS, Linux)
- Okular – KDE’s document viewer, which shows PostScript through Ghostscript (Linux, Windows)
- Inkscape – free vector editor that imports PostScript through Ghostscript (Windows, macOS, Linux)
Developers
- Ghostscript – PostScript interpreter that can be built into other programs as a library (C)
Reference
- PostScript Language Reference, third edition – Adobe’s definition of the language, 1999
- PostScript Language Document Structuring Conventions Specification, version 3.0 – Adobe’s rules for the
%%comments