Movatterモバイル変換


[0]ホーム

URL:


ContentsMenuExpandLight modeDark modeAuto light/dark, in light modeAuto light/dark, in dark modeSkip to content
Pillow (PIL Fork) 12.0.0 documentation
Light LogoDark Logo
Pillow (PIL Fork) 12.0.0 documentation
Back to top

PSDraw module

ThePSDraw module provides simple print support for PostScriptprinters. You can print text, graphics and images through this module.

classPIL.PSDraw.PSDraw(fp:IO[bytes]|None=None)[source]

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

begin_document(id:str|None=None)None[source]

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

end_document()None[source]

Ends printing. (Write PostScript DSC footer.)

image(box:tuple[int,int,int,int],im:Image.Image,dpi:int|None=None)None[source]

Draw a PIL image, centered in the given box.

line(xy0:tuple[int,int],xy1:tuple[int,int])None[source]

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

rectangle(box:tuple[int,int,int,int])None[source]

Draws a rectangle.

Parameters:

box – A tuple of four integers, specifying left, bottom, width andheight.

setfont(font:str,size:int)None[source]

Selects which font to use.

Parameters:
  • font – A PostScript font name

  • size – Size in points.

text(xy:tuple[int,int],text:str)None[source]

Draws text at the given position. You must usesetfont() before calling this method.

On this page

[8]ページ先頭

©2009-2025 Movatter.jp