[Zope] ZClass for PDFs

Loren Stafford lstaffor@dynalogic.com
Thu, 7 Sep 2000 20:44:24 -0700

From: "Timothy Wilson" <wilson@visi.com>

> On Thu, 7 Sep 2000, Tim Cook wrote:
> > Timothy Wilson wrote:
> > >
> > > I'd like to make a large number of PDF files available for download
from my
> > > site. HTML versions of the files will also be available for online
> > >
> > > I could certainly include the PDF files as regular file objects or I
> > > create a ZClass specifically for PDF files.
> > >
> > > I suspect that this question may be of general interest, so I'm asking
> > > comments about the pros and cons of either approach.
> > >
> >
> > Does this not do what you want?
> >
> > http://www.zope.org/Members/gaaros/ZpdfDocument
> Thanks for the pointer.
> It doesn't appear that the ZpdfDocuments is what I'm looking for.
> ZpdfDocument seems to render PDF on the fly from structured text or HTML.
> was interested in simply storing an existing PDF file in the ZODB and
> it available for download.
> Is there a reason to make a PDF ZClass? Would it make things easier?
> -Tim
There's an example of a PDF ZClass at
http://www.zope.org/Members/lstaffor/zProperties. If all you do in the class
is add simple properties as in this example, the arguments are in favor of
making a ZClass boil down to:

1. You can enforce the presence of certain properties.
2. In your navigation methods, you can use the metatype to distinguish PDF
files from other files and thereby treat them differently.
3. You can help content managers handle PDF files in a consistent manner.

...worthwhile, but not all that compelling arguments.

On the other hand, once you have a separate class, it's easier to add
functionality; for example,

1. Automatically catalog the content of the PDF by running it thru some
converter (like XPDF),
2. Extract the document properties from the PDF identification block.
3. Provide an alternative byte-serving access to large PDFs.

-- HTH
-- Loren