Question

Hello. I am a beginner TWiki user. I do have a PDF button (next to Edit, Attach) setup for GenPDF in TWiki 4.1 but I cannot see how to do this properly in Twiki 4.2. So what I am asking about is how to add another tab at the top of a topic so that I can click on it and get it to render PDF.

I do have genPDF working in TWiki 4.2 if I write the URL by hand. FYI. It's just that last bit of polish that got me stopped.

I have looked at the support site, googled and tried myself to get this working and have not found anything fully helpful.

Would someone please update the getPDF plugin page to show exactly the coding differences that are required to do this OR add a new"view.tmpl" or whatever file that shows how to do this.

Thank You Stephen

Environment

TWiki version: TWikiRelease04x02x00
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Ubuntu 7.10
Web server: Apache 2.2.4
Perl version: Perl 5.005
Client OS: Ubuntu 7.10
Web Browser: Firefox 2.0.0.1
Categories: Plugins

-- StephenHurrell - 23 Jan 2008

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

One way to do this and to isolate the changes so you don't have to edit the distributed templates is to override the skin.

For example, create a skin called "pdf" with the following steps.

First, In the templates directory, create a file called view.pdf.tmpl containing:

%TMPL:INCLUDE{"view.pattern"}%
%TMPL:DEF{"display_pdf_link"}%<span><a href='%SCRIPTURL{"genpdf"}%/%WEB%/%TOPIC%' rel='nofollow' title='Generate a PDF' >PDF</a></span>%TMPL:END%
%TMPL:DEF{"top:toolbarbuttons"}%%TMPL:P{"activatable_edit_or_create"}%%TMPL:P{"activatable_attach"}%%TMPL:P{"display_pdf_link"}%%TMPL:END%

What this does is

  • includes the pattern template,
  • creates a new template called display_pdf_link, and then
  • overrides the top:toolbarbuttons template to add a PDF button to the right of the Edit and Attach buttons.

Then, to activate the template, assuming you are using the default pattern template, add a Set statement to the WebPreferences or TWikiPreferences topics.

   * Set SKIN = pdf, pattern

-- GeorgeClark - 24 Jan 2008

If the last line of view.pdf.tmpl is changed to be:

%TMPL:DEF{"top:toolbarbuttons"}%%TMPL:P{"activatable_edit_or_create"}%%TMPL:P{context="new_topic" then="" else="activatable_attach"}%%TMPL:P{context="new_topic" then="" else="display_pdf_link"}%%TMPL:END%

Then when a new topic is being created, the Attach and PDF buttons are both removed.

-- GeorgeClark - 24 Jan 2008

Change status to:
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2008-01-24 - GeorgeClark
 
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.