[Zope] Displaying a pdf file.

Michael Guerrero mguerrero at tachyon.net
Fri Aug 15 15:59:11 EDT 2003


Thanks for your reply.

Specifically I am trying to do the following:

I have and existing application that does the following.
  1) user enters data then hits save
  2) data is stored in a oracle database
  3) the data plus some calculates are displayed back to the user in html

This works fine however I have a new requirement for #3.  Instead of displaying the data back to the user in html, I am to take the data add disclamer pages (total 4-5 pages) and display it to the user in pdf format.

To do this I plan to do the following after the user hits 'save':
  1) save the data in the oracle database
  2) call and external procedure that will run an oracle report to create the report,
     save it as a pdf file on the local unix file system (ex. 'myfile.pdf').
  3)?? THIS IS WHERE I NEED HELP ??
      I now need some way of having the user view this pdf file.

Am I over complicating this?  From zope can I just call a url (even if its on another web server that displays) the pdf.

I don't really need it in zope to view it, do !?

Thanks.

Mike



-----Original Message-----
From: J Cameron Cooper [mailto:jccooper at jcameroncooper.com]
Sent: Friday, August 15, 2003 11:59 AM
To: Michael Guerrero; Zope user list
Subject: Re: [Zope] Displaying a pdf file.


>
> 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>

You could write a script to automatically upload everything to Zope, use 
load_site.py, or copy your files using FTP or WebDAV.

If you really want to get them from the FS, get LocalFS and make a 
LocalFS object that points to, say, /docs. That's probably the easiest 
way. Well, aside from FTP.

If you want to grab it from a table, you'll want to write a Python 
script (with a .pdf extension!) that returns a single BLOB field, gotten 
by way of a ZSQL method. How that field is selected from the table can 
be determined by REQUEST variable parameters, acquisition context, or 
several other means. Obviously, this takes more work. Just remember that 
you *cannot* display the data inline. That will never work: you must 
return it looking like a single file.

          --jcc

-- 
"My point and period will be throughly wrought,
Or well or ill, as this day's battle's fought."





More information about the Zope mailing list