# `PSDraw` Module

The `PSDraw` module provides simple print support for PostScript printers. You can print text, graphics and images through this module.

class PIL.PSDraw.PSDraw(fp=None)

  Sets up printing to the given file. If `fp` is omitted, `sys.stdout.buffer` or `sys.stdout` is assumed.

  begin_document(id=None)

    Set up printing of a document. (Write PostScript DSC header.)

  end_document()

    Ends printing. (Write PostScript DSC footer.)

  image(box, im, dpi=None)

    Draw a PIL image, centered in the given box.

  line(xy0, xy1)

    Draws a line between the two points. Coordinates are given in PostScript point coordinates (72 points per inch, (0, 0) is the lower left corner of the page).

  rectangle(box)

    Draws a rectangle.

    Parameters

      box –

      A 4-tuple of integers whose order and function is currently undocumented.

      Hint: the tuple is passed into this format string:

          %d %d M %d %d 0 Vr

  setfont(font, size)

    Selects which font to use.

    Parameters

      - font – A PostScript font name

      - size – Size in points.

  text(xy, text)

    Draws text at the given position. You must use `setfont()` before calling this method.