/
GenPDFPrincePlugin.txt
73 lines (56 loc) · 3.44 KB
/
GenPDFPrincePlugin.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
%META:TOPICINFO{author="ProjectContributor" comment="reprev" date="1289486358" format="1.1" reprev="3" version="3"}%
---+!! %TOPIC%
This plugin generates PDF using the third-party tool [[http://www.princexml.com/][Prince XML]].
You will have to download this tool from their site and agree on the [[http://www.princexml.com/license/][license terms and conditions]].
Note that the non-commercial version can be used on a Foswiki server *for free*. In this case you will get a
watermark at the top right corner of the generated pdf although not visible when printed out.
<div class="foswikiImage">
<img src="%ATTACHURLPATH%/watermark.jpeg" alt="watermark" width="670" height="210" />
</div>
In case you'd like to use Prince XML for commercial purposes or just want to
get rid of this watermark, contact
[[mailto:princexml@michaeldaumconsulting.com][<nobr>MD Consulting</nobr>]] to purchase a
server license with a specific sales discount granted to Foswiki users.
---++ Usage
Get a PDF by adding =contenttype=application/pdf= to the view url like this:
<verbatim class="tml">
%SCRIPTURL{"view"}/%WEB%/%TOPIC%?contenttype=application/pdf&cover=print
</verbatim>
Optionally an url parameter =outfile= can be used to specifiy the target filename of the pdf being generated.
If not specified explicitly it defaults to =genpdf_%!TOPIC%.pdf=
<verbatim class="tml">
%SCRIPTURL{"view"}/%WEB%/%TOPIC%?contenttype=application/pdf&cover=print&outfile=myreport.pdf
</verbatim>
Here's the complete Foswiki documentation in [[%SCRIPTURL{"view"}%/%SYSTEMWEB%/CompleteDocumentation?contenttype=application/pdf][PDF]].
---++ Installation
You will have to download Prince XML from http://www.princexml.com/download.
If you are using other plugins that implement a =completePageHandler= (see InstalledPlugins) then you most
probably need to tune the =$Foswiki::cfg{PluginsOrder}= to list the %TOPIC% behind those. For example,
if you are using Foswiki:Extensions/ZonePlugin then you will have to list both giving them a specific order
how they execute the =completePageHandler=
<verbatim>
$Foswiki::cfg{PluginsOrder} = '...., ZonePlugin, GenPDFPrincePlugin';
</verbatim>
Note, that !ZonePlugin is not required anymore in newer Foswiki engines > 1.1.0.
%$INSTALL_INSTRUCTIONS%
---++ Plugin Info
<!--
* Set SHORTDESCRIPTION = 'Generate PDF using Prince XML';
-->
| Author: | Foswiki:Main.MichaelDaum |
| Copyright: | © 2009-2013, Michael Daum http://michaeldaumconsulting.com |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order --> |
| 18 Mar 2013 | added outfile url param to specify the file name of the pdf being generated |
| 08 Mar 2012 | fixed encoding of charset fed to prince xml; \
rewrite img urls from http: to file: urls while prince works on the local filesystem generating pdf |
| 17 Nov 2010 | using legacy interface =mkpath= to =make_path= to please older perl versions |
| 11 Nov 2010 | fixing incomplete image data in pdf |
| 07 Jun 2010 | added content-disposition to ease saving the pdf to disk |
| 20 Aug 2009 | improved error handling |
| 07 May 2009 | initial release |
| Home: | Foswiki:Extensions/%TOPIC% |
| Support: | Foswiki:Support/%TOPIC% |
%META:FILEATTACHMENT{name="watermark.jpeg" attachment="watermark.jpeg" attr="h" comment="" date="1289486214" size="19690" user="ProjectContributor" version="1"}%