Tags:
create new tag
view all tags
Printable pages

We have implemented a new function "printable", which is a copy of the "view" function.

Due to bugs in Netscape 4.x, we've found we cannot always print pages out of TWiki. Our TWiki pages include embedded class attributes as well as other HTML 4.0 elements. Netscape seems to display them correctly, but will not print them.

Also, it is nice to be able to print with minimal TWiki headers and footers, so we implemented a new template for Printable.

We duplicated the "view" function, and called it "printable". The changes are:

  • It pulls in a new template called "printable" which is a trimmed down version of the "view" template.
  • It includes a series of search and replace regexp statements at the end to remove anchor tags, class and style attributes, and style containers. Other deletions are easily added.
  • We altered the standard "view" template, by simply copying the entry for Attach, and replacing the "attach" with "printable":
    • From => "Edit | Ref-by | Attach | etc."
    • To => "Edit | Printable | Attach | etc."

The Printable code is attached.

-- RichardBennett - 10 Sep 2000

Hmm, this makes me wonder if we should extend the functionality of TWikiSkins, see custom rendering skins

-- PeterThoeny - 02 May 2001

This is nice, but there doesn't seem to be any way to print revisions other than the latest one. This limitation is in both the attached printable module here and in the skin-based Print command.

It would be pretty easy to add a "?rev=1.whatever" parameter to the Print link, but I don't see a template substitution variable that provides the revision number (%REVINFO% and %REVTITLE% are not in the appropriate format).

I don't know if there is a "right way" to do this, but what I've done is added this to my view module:

$tmpl =~ s/%REVNUMBER%/$rev/go;
and then added this line to the appropriate place in view.tmpl
| <A href="%SCRIPTURLPATH%/printable%SCRIPTSUFFIX%/%WEB%/%TOPIC%?rev=1.%REVNUMBER%">Print</A>

-- KristopherJohnson - 08 May 2001

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatext printable   manage 5.5 K 2000-09-11 - 04:22 UnknownUser New "printable" module
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2001-09-29 - MikeMannix
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.