--- ECHO_content/ECHO_collection.py 2004/11/29 20:39:08 1.192 +++ ECHO_content/ECHO_collection.py 2004/11/29 21:55:29 1.193 @@ -296,32 +296,33 @@ class ECHO_resource(Folder,Persistent,EC def createPDF(self,RESPONSE=None,local=None,dpi=150): """erzeuge pdf file""" pages=1 - + dpi=float(dpi) imagePath=self.getImagePath().replace("/mpiwg/online","") image="http://nausikaa2.mpiwg-berlin.mpg.de/digitallibrary/servlet/Scaler?fn="+imagePath+"&dw=%i&dh=%i&pn=%i" xmlInfo="http://nausikaa2.mpiwg-berlin.mpg.de/digitallibrary/dlInfo-xml.jsp?fn="+imagePath + dom=xml.dom.minidom.parse(urllib.urlopen(xmlInfo)) for parameter in dom.getElementsByTagName('parameter'): if parameter.getAttribute('name')=="pt": pages=int(parameter.getAttribute('value')) break - tempfile.tempdir="/tmp/archivesImageServer" - - tmpPath=tempfile.mktemp() + tempdir="/tmp/archivesImageServer" + if not os.path.exists(tempdir): + os.mkdir(tempdir) + + tmpPath=tempfile.mkdtemp(dir=tempdir) - tmpZip=tempfile.mktemp()+".pdf" - tmpFn=os.path.split(tmpZip)[1] + tmpZip=tempfile.mktemp(dir=tempdir) + tmpFn=os.path.split(tmpZip)[1] - if not os.path.exists(tempfile.tempdir): - os.mkdir(tempfile.tempdir) - if not os.path.exists(tmpPath): - os.mkdir(tmpPath) + + if RESPONSE: RESPONSE.setHeader("Content-Type","text/html") @@ -330,12 +331,12 @@ class ECHO_resource(Folder,Persistent,EC RESPONSE.write(txt) c=canvas.Canvas(tmpZip) - for i in range(1,pages): + for i in range(1,pages+1): if RESPONSE: RESPONSE.write(str("

Get Page: %i
\n"%i)) faktor=dpi/72.0 - fn=tmpPath+"/%i.png"%i + fn=tmpPath+"/%i"%i width,height=A4 #print image%(width*faktor,height*faktor,i)