postscript Getting started with postscript Hello World example


Select a font and fontsize, select location, show string.

/Palatino-Roman 20 selectfont
300 400 moveto
(Hello, World!) show

Notes and common pitfalls:

  • Failing to set a font (resulting in either no text or a default (ugly) font)

  • Using findfont and setfont but forgetting to scalefont in between. Using the level-2 selectfont avoids this problem and is more concise.

  • Failing to set a point with moveto, or setting the point outside of the page. For US letter paper 8.5x11 is 792x612 ps points. So it's easy to remember roughly 800x600 (but a smidge shorter and wider). So 300 400 is roughly the center of the page (little high, little left).

  • Forgetting to call showpage. If you preview a ps program with gs and it does not end in showpage, gs may display an image for you. And yet, the file will mysteriously fail to produce any output when you try to convert to pdf or something else.