Changes between Version 39 and Version 40 of TracWikiPrintPlugin
- Timestamp:
- May 19, 2015, 6:57:05 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracWikiPrintPlugin
v39 v40 1 1 [[PageOutline(2-5,Contents,pullout)]] 2 2 3 = !WikiPrint Trac Plugin = 4 == Description == 5 Make wiki pages easily printable, exporting to '''PDF''' (book or article format) or printable '''HTML''' format (page contents without trac headers/footers). PDF export is based on pure python libraries (such as [http://www.xhtml2pdf.com/ xhtml2pdf] and PISA), instead of depending on an external applications. 6 7 == Features == 8 * Fully customizable header/footers for PDF 9 * Syntax highlighting in exported format, using pygments 10 * Customizable front page for PDF book format 11 * Automatic creation of Table of Contents if ![[PageOutline]] or ![[TOC]] Macro is used 3 = !WikiPrint Trac Plugin 4 5 == Description 6 7 This plugin allows you to make wiki pages easily printable, exporting to '''PDF''' (book or article format) or printable '''HTML''' format (page contents without Trac headers/footers). PDF export is based on pure Python libraries, such as [http://www.xhtml2pdf.com/ xhtml2pdf], instead of depending on an external applications. 8 9 Key features: 10 * Fully customizable header/footers for PDF. 11 * Syntax highlighting in exported format, using Pygments. 12 * Customizable front page for PDF book format. 13 * Automatic creation of Table of Contents if ![[PageOutline]] or ![[TOC]] Macro is used. 12 14 * The style of the resulting PDF or HTML can be fully customized using CSS files. 13 15 14 == News == 15 * '''2013-02-07: Wiki'''. Cleaned up page and added more useful information. 16 * '''2011-09-26: Version 1.9.2'''. New option ''omit_macros'' to specify a list of macros to be removed on PDF. 17 * '''2011-09-23: Version 1.9.1'''. Included ''omit_links'' and ''rebase_links'' options in .ini section. 18 * '''2011-09-23: Version 1.9'''. Added ''link_format'', ''omit_links'' and ''rebase_links'' options. 19 * '''2010-05-05: Version 1.8.3'''. Some fixes, see Recent Changes below. 20 * ... 21 * '''2010-02-22: Version 1.8'''. Some fixes and improvements, see Recent Changes below. 22 * ... 23 * '''2008-04-07: Version 1.1'''. Fix problems with images and attachments with no !wiki:PageName, now it should work. 24 25 == Install == 16 == Bugs/Feature Requests 17 18 Existing bugs and feature requests for TracWikiPrintPlugin are [report:9?COMPONENT=TracWikiPrintPlugin here]. 19 20 If you have any issues, create a [http://trac-hacks.org/newticket?component=TracWikiPrintPlugin&owner=airadier new ticket]. 21 22 [[TicketQuery(component=TracWikiPrintPlugin&group=type,format=progress)]] 23 24 == Download 25 26 Download the zipped source from [download:tracwikiprintplugin here]. In addition to official Debian packages, there is an [http://dl.dropbox.com/u/4213259/deb/trac-wikiprint_1.8.4%2Br7935-0.1_all.deb unofficial Debian package] (with [http://dl.dropbox.com/u/4213259/deb/trac-wikiprint_1.8.4%2Br7935.orig.tar.gz src], [http://dl.dropbox.com/u/4213259/deb/trac-wikiprint_1.8.4%2Br7935-0.1.dsc dsc], and [http://dl.dropbox.com/u/4213259/deb/trac-wikiprint_1.8.4%2Br7935-0.1.debian.tar.gz debian changes]). 27 28 == Source 29 30 You can check out TracWikiPrintPlugin from [http://trac-hacks.org/svn/tracwikiprintplugin here] using Subversion, or [source:tracwikiprintplugin browse the source] with Trac. 31 32 === Patches 33 34 If you are running Windows & IIS and you should need to access resources locally and not via web browser (images, fonts), you may try the #9854 hotfix. Now in testing, please keep the ticket updated with results in order to release this. 35 36 == Installation 37 26 38 There are several '''dependencies''': 27 39 … … 44 56 * `easy_install http://trac-hacks.org/svn/tracwikiprintplugin/0.11` 45 57 46 Enable the plugin by adding '''wikiprint.* = enabled''' in the ''components'' section of the ''trac.ini''file:47 48 {{{ 58 Enable the plugin by adding '''wikiprint.* = enabled''' in the ''components'' section of your `trac.ini` file: 59 60 {{{#!ini 49 61 [components] 50 62 ... … … 57 69 * Printable HTML 58 70 59 == Settings == 71 == Settings 72 60 73 If you're behind a '''proxy''', add something like this to your .wsgi file so '''remote''' resources can be downloaded when creating pdfs: 61 74 62 {{{ 75 {{{#!python 63 76 import os 64 77 os.environ['http_proxy'] = 'http://myproxy.company.com:8080' 65 78 os.environ['no_proxy'] = '.company.com' 66 79 }}} 80 67 81 If you're using '''apache with authentication''', add something like this to your apache .conf file so '''local''' resources can be downloaded when creating pdfs (where `your.ip.address` is replaced with the output of `hostname -i`): 68 82 69 {{{ 83 {{{#!apache 70 84 ... 71 85 Require valid-user … … 77 91 ... 78 92 }}} 79 Additional options can be set by creating a ''wikiprint'' section in ''trac.ini'' (you can specify either local paths or remote urls for css and html files):80 81 {{{ 93 Additional options can be set by creating a ''wikiprint'' section in your `trac.ini` file: 94 95 {{{#!ini 82 96 [wikiprint] 83 97 toc_title = Table of Contents … … 93 107 omit_links = false 94 108 }}} 109 110 You can specify either local paths or remote urls for css and html files. 111 95 112 Most of these options can be also set from the web administrative interface: 96 113 97 114 [[Image(wiki:TracWikiPrintPlugin:admin_options.jpg, 60%, border=1)]] 98 115 99 === Customizing styles === 116 === Customizing styles 117 100 118 !WikiPrint allows customization of documents by three different options: 101 119 … … 106 124 For more information about the styles that affect the PDF output, see the [attachment:"pisa-en.pdf" xhtml2pdf manual]. 107 125 108 === Customizing front page, header, footer, contents === 126 === Customizing front page, header, footer, contents 127 109 128 * '''frontpage_url''': A path or URL to a file with HTML ('''It doesn't have to be a well formed xhtml document, so don't include begin/end tags, body, etc., see the default one'''), that will be used as the front page when exporting to ''PDF Book''. Some special tags can be used to insert the title, version, date, etc. See ''Tag Replacement'' 110 129 * '''extracontent_url''': A path or URL to a file with HTML that will be inserted at the beginning of the document before passing it to to ''xhtml2pdf''. This should be used to define the contents of the '''header''' and '''footer'''. See xhtml2html documentation, and the default article CSS contents and default extra contents for an example. 111 130 112 === Authentication === 131 === Authentication 132 113 133 When using cookie based authentication (like AccountManager), the ''xhtml2pdf'' library is given a temporary cookie to authenticate in behave of the user, so the conversion process will have the same permissions as the user downloading the .pdf, but '''you must make sure that the project URL is accessible locally from the trac server itself'''. 114 134 115 135 Optionally, is HTTP Basic or Digest authentication is used, wikiprint can be configured to log in using '''httpauth_user''' and '''httpauth_password''' options. 116 136 117 === Not available in administrative interface yet: === 137 Not available in administrative interface yet: 138 118 139 * '''rebase_links''': When generating PDF or printable HTML, change the base URL to the base URL specified with this option. Useful for changing local references (something like "http://localhost:8080") to a global address (like http://mycompany.com/trac). 119 140 * '''omit_links''': Remove internal wiki links from generated PDFs. 120 141 * '''omit_macros''': A comma separated list of macro names that will be omited when converting the wiki document to the selected output (PDF or printable HTML). 121 142 122 == Permissions == 143 == Permissions 144 123 145 Wikiprint defines three new permissions: 124 146 … … 127 149 * WIKIPRINT_FILESYSTEM: When setting up header, footer, style, etc. the user can enter a path to a file from the file system. In order for this to work, the user must have this ''WIKIPRINT_FILESYSTEM'' permission. Otherwise, this could mean a security risk, as the user might display ''/etc/passwd'' or critical files. This is not a WikiPrint problem, as anyone with TRAC_ADMIN permissions would be able to install and run a potentially insecure plugin. So, make sure you trust users with TRAC_ADMIN permissions, and you give WIKIPRINT_FILESYSTEM permission only to trusted users. 128 150 129 == Exporting and formats == 151 == Exporting and formats 152 130 153 !WikiPrint adds several download formats to the bottom of the wiki page. Following is the description of the available formats. 131 154 132 === PDF Article === 155 === PDF Article 156 133 157 PDF article creates a PDF file out of the wiki page, with no ''front page''. Additional styles will be used from the CSS file defined in ''article_css'' option. 134 158 … … 137 161 PDF article can be used to combine several wiki pages too, from the administrative interface. 138 162 139 === PDF Book === 163 === PDF Book 164 140 165 This format will create a book-like PDF document. A front page that can show title, subject, date and version is inserted at the beginning of the document. A 'Table of Contents' is also inserted after the front page. Any further ocurrences of ![[PageOutline]] will be removed. Different wiki pages will be separated by a page break. 141 166 … … 144 169 [[Image(wiki:TracWikiPrintPlugin:admin_makebook.jpg, 60%, border=1)]] 145 170 146 === Printable HTML === 171 === Printable HTML 172 147 173 This option will just convert to wiki text to HTML, and display it in the browser with some styles, so it can be printed directly from the browser. 148 174 149 === Combining pages === 175 === Combining pages 176 150 177 When enabling the plugin, a new !WikiPrint panel will be available in administration. From this panel, you can select a set of pages, and export them to any of the supported formats. 151 178 152 179 You can specify a Title, Subject, Date and Version for the exported document. 153 180 154 === Tag replacement === 181 === Tag replacement 182 155 183 When defining the contents of the ''front page'' file (using HTML), or the ''extra contents'' file (HTML for header, footer or other frames), some special tags can be used, and they will be replaced before exporting the document. 156 184 … … 162 190 * #VERSION: Replaced with the ''Version'' field when combining pages from the administrative interface, or the current page version when exporting from the wiki. 163 191 164 == Notes == 165 === xhtml2pdf special tags and styles === 192 == Notes 193 194 === xhtml2pdf special tags and styles 195 166 196 !WikiPrint works by converting one or some Wiki pages to HTML, adding some CSS styles and replacing special tags, and then passing the output to the xhtml2pdf library, so in order to understand how to customize the output using CSS, and to use some special html tags used by xhtml2pdf, you'll have to check the [attachment:"pisa-en.pdf" xhtml2pdf manual]. 167 197 168 198 Also, check the default ''css'' and ''extra_content'' files, as they provide usage examples. To see the contents of the default files, leave the corresponding field blank in the administration panel, and click the '''View''' button. 169 199 170 === Images and links === 200 === Images and links 201 171 202 !WikiPrint exports the wiki format to HTML first, then converts the HTML to PDF using xhtml2pdf library. Links and image references in the wiki to html conversion are made as absolute URLS. 172 203 … … 175 206 For example, if you access the trac project from your browser using the URL http://myserver/trac/myproject, but address of ''myserver'' is locally resolved at your workstation (via /etc/hosts or similar), and not globally known, then ''xhtml2pdf'' will fail to resolve ''myserver'' and won't be able to download the images from http://myserver/trac/myproject/. In that case, use the server IP instead. 176 207 177 == Bugs/Feature Requests == 178 Existing bugs and feature requests for TracWikiPrintPlugin are [report:9?COMPONENT=TracWikiPrintPlugin here]. 179 180 If you have any issues, create a [http://trac-hacks.org/newticket?component=TracWikiPrintPlugin&owner=airadier new ticket]. 181 182 == Download == 183 Download the zipped source from [download:tracwikiprintplugin here]. In addition to official Debian packages, there is an [http://dl.dropbox.com/u/4213259/deb/trac-wikiprint_1.8.4%2Br7935-0.1_all.deb unofficial Debian package] (with [http://dl.dropbox.com/u/4213259/deb/trac-wikiprint_1.8.4%2Br7935.orig.tar.gz src], [http://dl.dropbox.com/u/4213259/deb/trac-wikiprint_1.8.4%2Br7935-0.1.dsc dsc], and [http://dl.dropbox.com/u/4213259/deb/trac-wikiprint_1.8.4%2Br7935-0.1.debian.tar.gz debian changes]). 184 185 == Source == 186 You can check out TracWikiPrintPlugin from [http://trac-hacks.org/svn/tracwikiprintplugin here] using Subversion, or [source:tracwikiprintplugin browse the source] with Trac. 187 188 == Patches == 189 === Windows & IIS === 190 If you should need to access resources locally and not via web browser (images, fonts), you may try the #9854 hotfix. Now in testing, please keep the ticket updated with results in order to release this. 191 192 == Recent Changes == 208 == Recent Changes 209 193 210 [[ChangeLog(tracwikiprintplugin, 3)]] 194 211 195 == Author/Contributors == 196 '''Author:''' [wiki:airadier] [[BR]] '''Maintainer:''' [wiki:airadier] [[BR]] '''Contributors:''' (always welcome!) 212 == Author/Contributors 213 214 '''Author:''' [wiki:airadier] [[BR]] 215 '''Maintainer:''' [[Maintainer]] [[BR]] 216 '''Contributors:''' (always welcome!)