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
On Sat, Jun 15, 2002 at 09:57:27AM -0700, Erik Myllymaki wrote:
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
open(pdf_filename, "rb") will probably solve your problem. hth Jerome Alet
thanks, that was the problem ;-) ----- Original Message ----- From: "Jerome Alet" <alet@librelogiciel.com> To: "Erik Myllymaki" <erik.myllymaki@pacific-shores.com> Cc: <zope@zope.org> Sent: Saturday, June 15, 2002 10:41 AM Subject: Re: [Zope] pdf generator troubles
On Sat, Jun 15, 2002 at 09:57:27AM -0700, Erik Myllymaki wrote:
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
open(pdf_filename, "rb")
will probably solve your problem.
hth
Jerome Alet
participants (2)
-
Erik Myllymaki -
Jerome Alet