[go: up one dir, main page]

Menu

Tree [72b583] master / tests / python /
 History

HTTPS access


File Date Author Commit
 AlteSchwabacher.afm 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 AlteSchwabacher.enc 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 AlteSchwabacher.pfb 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 Helvetica.afm 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 Helvetica.pro 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 README 2005-06-08 Stefan FKP Stefan FKP [caca12] typo.
 cork.enc 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 dice.afm 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 dice.pfb 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 draft.inc 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 draw.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...
 einstein.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...
 einstein.txt 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 exectime.inc 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 fontsample.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...
 grid.inc 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 hyperlinks.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...
 hyph_de.dic 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 hyph_en.dic 2005-06-08 Stefan FKP Stefan FKP [2e8acc] Iniital release by stefan.
 image.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...
 invitation.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...
 ligatures.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...
 make_all.sh 2005-06-16 Stefan FKP Stefan FKP [a8df58] Added optional generation of an all in one psfile.
 mandelbrot.py 2005-06-16 Stefan FKP Stefan FKP [f65eaa] Arange function is buggy, replaced by frange fr...
 overprint.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...
 pagehook.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...
 pilcooperate.py 2015-12-27 Uwe Steinmann Uwe Steinmann [90a10f] fix path to python executable
 psclock.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...
 pycal.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...
 shading.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...
 spotcolor.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...
 symbol.py 2005-06-09 Stefan FKP Stefan FKP [bafb3c] Path to images added. Now images from c-tests a...

Read Me

#
# README examples
# This file is part of python-pslib
# Written by Stefan Schroeder
#

To test python-pslib simply run

bash make_all.sh

in this directory. Some examples are slightly modified from the C-version.
E.g. I renamed the included pagehook-postscript files to *.inc, to be able
to easily remove all generated postscript files with *.ps without touching
the include files.

The command above will run all examples and create several postscript
files. Have a look at them to get acquainted with pslib's
capabilities. Study the python code to learn hwo a particular command 
is used. Please do not assume to find an example for every pslib command.
We are working on it.

Have a nice day.

Stefan Schroeder

-= Using Python with PSlib =-

To create a postscript-file we need to take three steps:

1. Open the file and write some introductory information.
2. Draw and write some graphs and text.
3. Close the file.

An extensive minimal python script could look like this:

##########################################################
#!/usr/bin/python

import pslib

# Create an new instance 
psdoc = pslib.PS_new() 

# Open a file, pslib also allows to use an already open file handler.
pslib.PS_open_file(psdoc, "helloworld.ps") # 

# Select a font, use the default encoding and do not embed.
# 
foofont = ps.PS_findfont(psdoc, "Helvetica", "", 0)

# Start a new page in A4 format, units are postscript pixels.
pslib.PS_begin_page(psdoc, 596, 842) 
# Letter would be 612x792.

# Print at coordinate (x=100|y=200) 
pslib.PS_show_xy(psdoc, "Hello World", 100, 200) 
# (0|0) is located at the bottom left corner.

# And some cleanup, don't omit this.
pslib.PS_end_page(psdoc)
pslib.PS_deletefont(psdoc, foofont)
pslib.PS_close(psdoc)
pslib.PS_delete(psdoc)
##########################################################

To learn more about postscript visit:

http://www.postscript.org/FAQs/language/FAQ.html

http://www.geocities.com/SiliconValley/5682/postscript.html

http://www.id.unizh.ch/publications/ps/