Sping (was PIDDLE) not producing PDF file
Steve Holden
sholden at holdenweb.com
Fri Feb 16 09:20:07 EST 2001
This is a little program I used to produce digital camera thumbnail listings
under 1.5.2 which worked fine. I've loaded sping and PIL under 2.0 (where's
all the documentation gone?) and modified the code to accommodate the new
packaging structure. It runs, but seems to produce no PDF file. Can anyone
point out what I might be doing wrong?
regards
Steve
from sping import *
from sping.PDF import PDFCanvas, Font
import PIL.Image, os.path, sys, glob
MAXLINE = 8
MAXCOL = 4
LINEHEIGHT = 100
COLWIDTH = 140
LEFTMARGIN = 45
TOPMARGIN = 45
fntLarge = Font(face="helvetica", size=16, bold=1)
fntMedium = Font(face="helvetica", size=12, bold=1)
fntSmall = Font(face="helvetica", size=8, bold=0)
imagename = []
for filepat in sys.argv[1:]:
for infile in glob.glob(filepat):
imagename.append(infile)
imagename.sort()
lineno = MAXLINE+1
colno = MAXCOL+1
pageno = 0
out = PDFCanvas(name = "C:\PhotoClips.pdf")
for i in range(len(imagename)):
if colno >= MAXCOL:
lineno = lineno+1
colno = 0
if lineno >= MAXLINE:
lineno = 0
colno = 0
if pageno > 0: out.clear()
pageno = pageno +1
print imagename[i]; sys.stdout.flush()
im = PIL.Image.open(imagename[i])
imx = colno*COLWIDTH+LEFTMARGIN
imy = lineno*LINEHEIGHT+TOPMARGIN
out.drawImage(im.resize((220,146)), imx, imy, imx+109, imy+72)
out.drawString(os.path.basename(imagename[i]),
imx, imy+80, fntSmall)
colno = colno +1
out.flush()
--
--
Tools, training and technology to help you meet your information needs
More information about the Python-list
mailing list