[Zope] pdf generator troubles
Erik Myllymaki
Erik Myllymaki <erik.myllymaki@pacific-shores.com>
Sat, 15 Jun 2002 09:57:27 -0700
DTML calls an external method to show a PDF file inline:
<dtml-call "RESPONSE.setHeader('content-type','application/pdf')">
<dtml-call
"RESPONSE.setHeader('Content-Disposition','inline;filename=somefile.pdf')"><
dtml-var expr="pdftest('C:\somefile.pdf')">
external method is like this:
--------------------------------------------------
def pdftest(pdf_filename):
import sys
f=open(pdf_filename)
y = f.read()
f.close()
return y
---------------------------------------------------
But I always get a *File is damaged* error no matter what PDF file I give
it. Testing the function outside of zope, it returns only part of each PDF.
as soon as it hits STREAM it stops...?
Zope 2.3.2 on WinNT Server 4.0
Note:tested ONLY with IE 5.5 on win2k