How to patch vanilla JPSWiki to support a print page:
  • go to your webapp dir like /usr/local/tomcat_wiki/webapps/wiki/
  • copy ~Wiki.jsp to WikiPrint.jsp
  • modify WikiPrint.jsp
    • inside, change String contentPage = "templates/"+skin+"/ViewTemplate.jsp"; to
String contentPage = "templates/"+skin+"/PrintTemplate.jsp";

in version 2.2.1-beta change
String contentPage = wiki.getTemplateManager().findJSP( pageContext,
wikiContext.getTemplate(),
"ViewTemplate.jsp" );
to
String contentPage = wiki.getTemplateManager().findJSP( pageContext,
wikiContext.getTemplate(),
"PrintTemplate.jsp" );
  • go to ./templates/default
  • copy ViewTemplate.jsp to PrintTemplate.jsp
    • inside, change whatever you like
    • most notably, remove (or comment out) the first <TD>...</TD> block which contains the left menu
  • modify ViewTemplate.jsp to have a link to the print page somewhere:
    • like <a href="<wiki:Variable var="baseURL"/>WikiPrint.jsp?page=<wiki:variable var="pagename"/>">PRINT-VERSION</a>

there might be many better ways to do the link, but all this was "researched" and done in 15min, with no prior experience with JSPWiki. Feel free to improve all this.

Recommended way#

NB: The above way is NOT RECOMMENDED for 2.2.1. If the Wiki.jsp page changes across releases (which it will), you will have a hard time keeping up with the changes. If you want to do this as a proper template, rename templates/default/WikiTemplate.jsp to templates/print/ViewTemplate.jsp, and add
<a href="Wiki.jsp?page=<wiki:Variable var="pagename"/>&skin=print">Print friendly</a>
to your templates/default/ViewTemplate.jsp in some proper place. -- JanneJalkanen

Default way#

Please note that JSPWiki 2.2 supports a proper style sheet jspwiki_print.css for printing. This is supported in most modern browsers automatically, with no special "Print Friendly" page needed. -- JanneJalkanen
11. Dec. 2007: The default way seems to be broken on Firefox. Some pages are printed correctly, others (JSPWikiStyles) are not.
17. Jan. 2008: Just found that issue discribed and solved on JIRA: https://issues.apache.org/jira/browse/JSPWIKI-128 -- StefanBohn

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-29) was last changed on 05-May-2010 16:38 by 81.140.10.68