source: tracwikiprintplugin/trunk/README.md

Last change on this file was 18312, checked in by Cinc-th, 2 years ago

TracWikiPrintPlugin: fix unicode error with Trac 1.4. Minor changes to README.md.

File size: 5.7 KB
RevLine 
[18311]1TracWikiPrintPlugin
2===================
3This plugin allows you to export to PDF (book or article format) or printable HTML format (page contents without Trac headers/footers) allowing easy printing. PDF export is based on [wkhtmltopdf](https://wkhtmltopdf.org/).
4
[18312]5Older versions up to V3.0.0 used [xhtml2pdf](http://www.xhtml2pdf.com/) for generating PDF files. While having the advantage of being a pure Python solution it was abandoned because the output quality of [wkhtmltopdf](https://wkhtmltopdf.org/) is way better. For these unsupported older releases see [WikiPrintXhtml2pdf](https://trac-hacks.org/wiki/TracWikiPrintPlugin/WikiPrintXhtml2pdf).
[18311]6
7Key features:
8
[18312]9* Administration page for default settings.
[18311]10* Customizable footers for PDF.
11* Customizable front page for PDF book format.
12* Automatic creation of Table of Contents for PDF books.
13* The style of the resulting PDF or HTML can be fully customized using CSS.
14* Different page sizes.
15* PDF "print dialog" for altering settings prior to PDF file creation.
16* Makro to specify contents and format of PDF Books with export feature.
17
[18312]18The plugin is seamlessly integrated in the Trac user interface by adding items to the `Download in other formats` section of each wiki page.
[18311]19
20The full documentation can be found on the homepage: [TracWikiPrintPlugin](https://trac-hacks.org/wiki/TracWikiPrintPlugin) (https://trac-hacks.org/wiki/TracWikiPrintPlugin)
21
22### Supported Trac releases
23
24Trac 1.4 and 1.6 are fully supported.
25
26For older releases use TracWikiPrintPlugin V3.x.x or older.
27
28License
29-------
30
31Releases up to V3.x.x were licensed as GPL.
32
33With V4.0.0 the plugin was rewritten from scratch and is now BSD licensed.
34
35Download
36--------
37Download the zipped source from [here](https://trac-hacks.org/browser/tracwikiprintplugin?format=zip).
38
39Source
40------
41You can check out [TracWikiPrintPlugin](https://trac-hacks.org/wiki/TracWikiPrintPlugin) from [here](https://trac-hacks.org/svn/tracwikiprintplugin) using Subversion, or [browse the source](https://trac-hacks.org/browser/tracwikiprintplugin) with Trac.
42
43Installation
44------------
45To install the plugin from trunk:
46
47    $ pip install https://trac-hacks.org/svn/tracwikiprintplugin/trunk
48
49To install the older `V3.0.0` release:
50
51    $ pip install https://trac-hacks.org/svn/tracwikiprintplugin/tags/V3.0.0
52
53Install [wkhtmltopdf](https://wkhtmltopdf.org/).
54
55*Note:* [wkhtmltopdf](https://wkhtmltopdf.org/) must be in your path or more precisely in the path used by Trac.
56
57Enable the plugin using Tracs plugin administration page or by adding `wikiprint.* = enabled` in the components section of your `trac.ini` file:
58
59```
60[components]
61...
62wikiprint.* = enabled
63```
64
65Usage
66-----
67
[18312]68After the plugin is enabled, a new administration panel will be available under the `Wikiprint` section, and 4 new download formats will be available in the `Download in other formats` section at the end of each wiki page:
[18311]69
70* Printable HTML
71* PDF Page
72* PDF Page (custom settings)
73* PDF Book
74
75A new makro `PdfBook` can be used to create PDF books from any number of wiki pages.
76
77### Administration page
78
79The default configuration for page exports may be provided using the `Wikiprint` administration page. These settings apply when not overriden by the user while exporting a PDF. While most settings are related to PDF files the style page specified here also applies when generating the `Printable HTML` page.
80
81### Printable HTML
82
83The wiki page is stripped from Tracs footer, header and navigation. The resulting page only contains the wiki content.
84
85Styling of the page is according to the style page selected using the administration panel.
86
87### PDF Page
88
[18312]89`PDF Page` creates a PDF file out of the wiki page, with no cover page. Styles will be used from the style page defined in the global configuration set with the administration panel.
[18311]90
[18312]91Table of contents macros in the wiki page like `[[PageOutline()]]` or others are not stripped from the page.
[18311]92
93### PDF Page (custom settings)
94
[18312]95The wiki page is exported as a PDF file. This is like normal `PDF Page` export but it is possible to override the global configuration while generating the PDF file. A settings page similar to a "print dialog" is presented to the user before the actual export happens.
[18311]96
97### PDF Book
98
[18312]99This will create a book-like PDF document. While exporting the user is presented with a settings page to specify a cover page and whether a table of contents should be added. Styling may be changed by selecting one of the available style page. The cover page used for the book may be any wiki page.
[18311]100
[18312]101Common table of contents macros in the wiki page like `[[PageOutline()]]` or `[[TracGuideToc()]]` are removed from each wiki page.
[18311]102
103### PdfBook makro
104
105Using the makro it is possible to define PDF books with any number of wiki pages a cover page and table of contents. The configuration specified in the makro may always be overriden by the user while creating the book. This way one may for example change the predefined cover page or omitt the table of contents. Note that you can't add or remove pages while creating the book.
106
107The configuration from the makro is rendered to the user and a button added to create the PDF book. Note that only one PdfBook makro on a wiki page is supported.
108
109The makro must be specified in WikiProcessors syntax:
110
111```
112{{{#!PdfBook
113...
114}}}
115```
116
117The contents must be formatted like an INI file. The following sections are defined:
118
119* `[parameters]`: specify cover page and table of contents
120* `[pages]`: list of wiki pages to add to the book.
121
122```
123{{{#!PdfBook
124[parameters]
125# Name of a wiki page to be used as the cover page
126cover = CoverPage
127# Set to 1 for a table of contents, else set to 0
128toc = 1
129
130[pages]
131# Names of wiki pages to be added to the PDF book.
132WikiStart
133WikiFormatting
134}}}
135```
Note: See TracBrowser for help on using the repository browser.