back next

The PSDraw Module

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

Classes #

PSDraw #

PSDraw.PSDraw(file) ⇒ PSDraw instance

Sets up printing to the given file. If file is omitted, sys.stdout is assumed.

PSDraw Methods #

begin #

ps.begin_document()

Sets up printing of a document.

end #

ps.end_document()

Ends printing.

line #

ps.line(from, to)

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 #

ps.rectangle(box)

Draws a rectangle.

text #

ps.text(position, text)

ps.text(position, text, alignment)

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

image #

ps.image(box, image, dpi=None)

Draw an image, centered in the given box.

setfont #

ps.setfont(font, size)

Selects which font to use. The font argument is a Postscript font name, the size argument is given in points.

setink #

ps.setink(ink)

Selects the pixel value to use with subsequent operations.

setfill #

ps.setfill(onoff)

Selects if subsequent rectangle operations should draw filled rectangles or just outlines.

 

A Django site. rendered by a django application. hosted by webfaction.