This is a servlet that makes it possible to view, export or save a Wiki page as a PDF file. It's not technically a plugin, but this seemed the natural place for it anyhow.
Recommended installation #
- Download jspwiki2pdf-jar-with-dependencies
and place it in your WEB-INF/lib folder of your JSPWiki installation
- Add the following to your WEB-INF/web.xml:
<servlet> <servlet-name>Wiki2PDFServlet</servlet-name> <servlet-class>com.palbrattberg.jspwiki.Wiki2PDFServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>Wiki2PDFServlet</servlet-name> <url-pattern>/wiki.pdf</url-pattern> </servlet-mapping>
- Add a link to the service in any page, templates/default/ViewTemplate.jsp is a good candidate:
<a href="wiki.pdf?page=<wiki:Variable var="pagename" />&ext=.pdf">View PDF</a>Restart your servlet runner (Tomcat, Resin or whatever you use) and you should now be able to view pages as PDFs.
If you are unsuccessful in installation, read PDFPluginProblems for common problems and their solutions.
The link itself accepts the following parameters:
page | The name of the page you wish to create a PDF file of. (Required) |
---|---|
xsl | The name of an XSL-file that should be used to convert the XML FO file into a PDF. If you add your own XSL-file, place it in the WEB-INF/classes folder for jspwiki2pdf to find it. Default value: default.xsl. (Optional) |
encoding | ID of the encoding to be used like UTF-8 or ISO-8859-1. (Optional) |
ext | If you experience problems with Internet Explorer, it might help to add an URL parameter last in the request that ends with .pdf. (Optional) |
You might also want to take part in the PDFPluginDiscussion.
The plugin is developed at http://code.google.com/p/jspwiki2pdf
Installation with you own dependencies (difficult)#
In case you wish to control the versions of the dependencies or you experience problems with clashing JAR-files you can use the JAR-file without dependencies

Apache FOP is used to transform XML to PDF.
Download the binary distribution from apache
Unpack it, and copy the following libraries to WEB-INF/lib:
- avalon-framework.jar (or whatever version, avalon-framework-cvs-20020806.jar for example)
- batik.jar
- fop.jar
jTidy is used to transform HTML to XML.
Download the jTidy binary distribution
Unpack it, and copy Tidy.jar to WEB-INF/lib.
Release history#
2.2 2008-03-17 PålBrattberg- Upgraded FOP to 0.94 from 0.93
- Added prefix to local links to turn them into a complete URL (contributed by Henrik Zätterman)
- Added encoding parameter (optional) to the link so that the encoding can be changed for the source page when generating the PDF files (contributed by Henrik Zätterman)
2.1.1 2007-06-18 PålBrattberg
- Fixed copyright issue in default.xsl
2.1 2007-06-14 PålBrattberg
- Brand new release, incorporating setup-free image and table support from the get-go! Note that this release changes the installation instructions and if you're updating, change the package name from se.eminds to com.palbrattberg (my old company is no more).
- Created a jspwiki2pdf project
at Google Code for easier collaboration. Let me know if you need commit access to the repository.
- Now supplying both a stripped, no-frills JAR-file with only the jspwiki2pdf-specific code and a new, all-inclusive JAR with all dependencies included for easier installation.
- Images and tables should both work out-of-the-box! If not, please file an issue a the jspwiki2pdf issue tracker
.
- Created a PDFPluginTestPage as well as a downloadable PDF of the test page
.
2.0 2006-08-24 Candid Dauth
It was possible to view pages that you didn't have access to via PDF. I just committed a patch that fixes this.
1.2 2006-08-18 Candid Dauth
I just modified wiki2pdf.jar a little bit, now it is possible to view the PDFs via HTTPS in Internet Explorer. I also included xhtml2fo4fop.xsl, which adds table and image support. See PDFPluginDiscussion for further information.
1.1 2005-03-11 PålBrattberg
Fixed problem with extended char sets. Tested with both UTF-8 and ISO-8859-1. Changed link from wiki:PageName to wiki:Variable var="pagename" to handle pages with spaces correctly.
1.0 2005-03-10 PålBrattberg
First release, based on previous work by Rino. I looked at his work on (IdeasPDFWriter), but it seems he's no longer maintaining that work, so I created a new (and IMHO, simpler) servlet based on his work.
In case you'd like an alternative to this plugin, you might like PDF Generation using CSSToXSLFO better.
I also needed xmlgraphics-commons-1.3.1.jar - I think this is because I am using FOP 0.95
As an alternative to adding the link to the ViewTemplate.jsp you can add it to the More... menu by following these steps:
1. Add the following lines to the templates\default.propeties file:
actions.viewpdf=View Page PDF actions.viewpdf.title=View the currect page in PDF format
2. Add the following lines to the templates\default\Favorites.jsp file:
<li><a class="action" href="<wiki:BaseURL/>wiki.pdf?page=<wiki:PageName />&ext=.pdf" title="<fmt:message key='actions.viewpdf.title' />"><fmt:message key='actions.viewpdf' /> </a></li>
3. Restart your application server
--AnonymousCoward, 13-Mar-2009 22:57
Add new attachment
List of attachments
Kind | Attachment Name | Size | Version | Date Modified | Author | Change note |
---|---|---|---|---|---|---|
jar |
wiki2pdf.jar | 15.7 kB | 10 | 18-Jun-2007 08:59 | Pål Brattberg | Fixed copyrigth notice in XSL |
zip |
wiki2pdf_css2fop.zip | 13.0 kB | 2 | 16-Nov-2005 18:59 | KieronWilkinson |