[Zope] Displaying a pdf file.
David Hassalevris
bluepaul at earthlink.net
Thu Aug 14 19:20:10 EDT 2003
Michael,
Could you be more specific? What is it *exactly* you cannot do?
Your question raises alot of issues.
if you just want to know what do once you have access to the correct pdf then do something like (roughly in code)
*yourExternalPythonScript*
def someName(self,REQUEST,RESPONSE):
parent = self.aq_parent
res = parent.yourZsql(pdf_id = REQUEST[pdf_id]) # get the pdf from your DB
record = res.dictionaries()
for n in record:
pdf = record['PDF']
RESPONSE.setHeader('Content-Type','application/pdf')
RESPONSE.setHeader('Content-Length',len( pdf ))
RESPONSE.write( pdf)
*the calling dtml script that displays the pdf*
<dtml-call "REQUEST.set('pdf_id',pdf_id)">
<dtml-call "yourExternalPythonSCript(PARENTS[0],REQUEST,RESPONSE)">
David
----- Original Message -----
From: Michael Guerrero
To: zope at zope.org
Sent: Thursday, August 14, 2003 4:38 PM
Subject: [Zope] Displaying a pdf file.
Hello,
What is the best way to display a pdf file in a zope application. I may select the file from an oracle database of get it from a file system. I'm not sure at the moment.
My Zope Bible book shows how to upload a pdf file from a filesytem then view it. But in my case the pdf I want to view is based on an ID entered by the user. There may be many different pdf and I can't upload them all.
I want to be able to
1) if the the pdf is on server then
view (\docs\my.pdf) using the correct application type
or
2) if I select the pdf from an oracle table (stored as a BLOB)
<dtml-in sql-get_pdf>
somehow display the pdf
</dtml-in>
Thanks for your help
Mike Guerrero
------------------------------------------------------------------------------
_______________________________________________
Zope maillist - Zope at zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.zope.org/pipermail/zope/attachments/20030814/6c06f873/attachment.htm
More information about the Zope
mailing list