[Zope] print functon?

Joel Burton jburton@scw.org
Fri, 20 Jul 2001 14:50:49 -0400 (EDT)


On Fri, 20 Jul 2001, Tino Wildenhain wrote:

> Hi,
> 
> --On Freitag, 20. Juli 2001 09:39 -0400 Joel Burton <jburton@scw.org> wrote:
> 
> > On Fri, 20 Jul 2001, Tino Wildenhain wrote:
> >
> >> Hi Ismet,
> >>
> >> define "printable" :-)
> >>
> >> Regards
> >> Tino
> >>
> >> --On Freitag, 20. Juli 2001 20:05 -0700 Ismet Dere
> >> <ismet@fiducia-china.com> wrote:
> >>
> >> > hello all,
> >> >
> >> > howto create a printable version of current document in zope, is there
> >> > any DTML/Python script available for this?
> >
> > On our site, we have a "Print" button that does the following:
> >
> > 1) Calls the page you're on, with "?pp=1" at the end
> >
> > 2) Our standard_html_header and standard_html_footer check for pp=1,
> > and if so, show standard_print_header and standard_print_footer.
> >
> > standard_print_* show heads & footers that are simplified, lack
> > complex table stuff, etc. They also use a different CSS file
> > that is more print-oriented.
> >
> > 3) The link to the Print page uses target=_blank so that the printable
> > version can be closed, and the original page is still there.
> 
> Nice, but if you drop the idea of documents or at least use
> a ZClass for them, you can add a method index_html for
> displaying them as usual and print to display them for printers.
> 
> This would show the URL yourpage/print vs. yourpage?pp=1
> And enables you to still pass other arguments to the page.
> (As sideeffect not every page has to have <dtml-var standard_html_header> 
> and stuff in it)

In our case, everything uses standard_html_header or simple_html_header,
or navigation-lite version, so it wasn't a problem. If we didn't have this
consistency, we'd have problems, of course.

I *like* the ?pp=1 at the end. The usual arguments about how
scw.org/foo/print is nicer than scw.org/foo?pp=1 doesn't hold too well
here, since I don't want search engines to archive our printable versions,
etc.

A ZClass would be a clean solution, but given that we use StructuredText
products, DTMLDocuments, DTMLMethods, etc., it would be hard to have a
separate ZClass wrapper for each to handle the /print functionality. If
you really wanted the nice clean URL scw.org/foo/print, perhaps you could
add a "print" PythonScript or such at the root of your site that would
mangle that called object to make it look printable.

Take care!


-- 
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington