DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:html2pdf

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:html2pdf [2009-12-27 08:22] 125.131.236.242plugin:html2pdf [2019-08-16 15:05] (current) Aleksandr
Line 1: Line 1:
-====== html2pdf plugin ======+====== html2pdf Plugin ======
  
 ---- plugin ---- ---- plugin ----
-description: Exports HTML to PDF.+description: Exports HTML to PDF
 author     : Daniel Stonier author     : Daniel Stonier
 email      : d.stonier@gmail.com email      : d.stonier@gmail.com
Line 10: Line 10:
 depends    :  depends    : 
 conflicts  conflicts 
-similar    : pdfex, pdfdownload +similar    : pdfex 
-tags       : export, pdf+tags       : export, pdf, !broken 
 + 
 +sourcerepo : https://github.com/stonier/dokuwiki_plugins/tree/master/html2pdf 
 +bugtracker : https://github.com/stonier/dokuwiki_plugins/issues 
 +downloadurl: https://github.com/stonier/dokuwiki_plugins/archive/master.zip
 ---- ----
  
Line 24: Line 28:
   * Outputs graphics of reasonable quality.   * Outputs graphics of reasonable quality.
  
-===== Links =====+===== Demo (not working) =====
  
-  * [[http://snorriheim.dnsdojo.com/redmine/wiki/html2pdf/Instructions|Home Page]] 
   * [[http://snorriheim.dnsdojo.com/doku/doku.php/en:help:plugins:image|Demo]]   * [[http://snorriheim.dnsdojo.com/doku/doku.php/en:help:plugins:image|Demo]]
-  [[http://snorriheim.dnsdojo.com/redmine/wiki/html2pdf/Installation|Installation]] + 
-  * [[http://snorriheim.dnsdojo.com/redmine/wiki/html2pdf/ExportButtons|Export Link/Button]] +===== Installation ====== 
-  * [[http://snorriheim.dnsdojo.com/redmine/wiki/html2pdf/TroubleShooting|TroubleShooting]] + 
-  * [[http://snorriheim.dnsdojo.com/redmine/wiki/html2pdf/FAQ|Faq]] +Download and install the plugin using the Plugin Manager using the following url. 
-  * [[http://snorriheim.dnsdojo.com/redmine/projects/html2pdf/boards|Forum]]+ 
 +  https://github.com/stonier/dokuwiki_plugins/raw/master/releases/html2pdf_20100120.tar.gz 
 + 
 +Warning! This is a large file (~36MB) and the plugin manager would not handle it for me (not sure where that's a DokuWiki setting or an Apache setting at this point in time). Alternatively, you can install it manually, just download and install into the doku/lib/plugins directory. 
 + 
 +===== Links ===== 
 + 
 +== Insufficient Memory == 
 + 
 +The html2ps script is pretty greedy and you might not have enough memory reserved for the PHP script. When this happens, it will return with an error stating so. To increase the memory:  
 +Edit your php.ini file, set the memory_limit variable to 128K or more. Restart the web server. 
 + 
 +== Bad CSS == 
 + 
 +The html2pdf script doesn't know how to handle the !important CSS property so internal links do not get styled. If you want them to show up as they appear on the web page, go into your template and edit /lib/tpl/_template/design.css, looking for the a.wikilink# (where # is 1 or 2) pattern and edit out the !important pieces. Other css changes can be affected here also. 
 + 
 +== Blank PDF Output == 
 + 
 +Check that the html is being made in doku/lib/plugins/html2pdf/tmp/export_pdf.html. 
 +Check that the html2pdf is working with the systemcheck link in the troubleshooting section above. 
 +Especially check curl and ghostscript - you need php with curl use flag and ghostscript package installed. 
 +Make sure your entire directory is read/writeable by your web server user (usually apache:apache). 
 + 
 +== Large PDF File Size == 
 + 
 +Aye, thats normal. The holy grail of easily convertable documents isn't really here yet (though I've seen a project aiming to get there), but this is the best I've seen for faithfully rendering what you see in a dokuwiki page to pdf, even if it is pretty heavy getting there. I wouldn't use it for anything more than one or two page documents - but wiki pages should ideally never get longer than that if you're using the wiki as it should be used. 
 + 
 +===== Export Link/Button ===== 
 + 
 +To use the plugin, you simply need to call the page passing it a “do=export_pdf” php argument. The easiest way to implement this is to add a button or similar somewhere in your template design. 
 + 
 +== Dokubook == 
 + 
 +I use an extended dokubook for this, and have the following code inserted into the top__nav unordered list in main.php: 
 + 
 +<code php> 
 +$pdf_plugin = &plugin_load('action','html2pdf'); 
 +if ( $pdf_plugin ) { 
 +  if ( !plugin_isdisabled($pdf_plugin->getPluginName() ) ) { 
 +    print '<li>'.DOKU_LF; 
 +    print '  <a href="'; 
 +      echo exportlink($ID, 'pdf'); 
 +      print '" class="action tab_pdf" rel="nofollow">Export Pdf</a>'.DOKU_LF; 
 +    print '</li>'.DOKU_LF; 
 +  } 
 +
 +</code> 
 + 
 +The appropriate bit of CSS is added for tab_pdf in dokubook_design.css. 
 + 
 +== Monobook == 
 + 
 +When using the template “monobook for DokuWiki”, and using the “default toolbox”, you simply have to add two lines in context.php (line 355) of the template: 
 + 
 +<code php> 
 +$monobook['defaulttoolbox']['pdf']['href'] = exportlink($ID, 'pdf'); 
 +$monobook['defaulttoolbox']['pdf']['text'] = 'Export PDF'; 
 +</code>
  
 ===== Issues and Requests ===== ===== Issues and Requests =====
Line 64: Line 124:
  
 Run the systemcheck link (see the troubleshooting section above) and check everything is in working order. Is it primarily a fonts or graphics problem? Run the systemcheck link (see the troubleshooting section above) and check everything is in working order. Is it primarily a fonts or graphics problem?
 +
 +
 +=== Too heavy ===
 +I see the interest to include the font, but the result is really too heavy; such files cannot even be sent by mail! \\
 +Pat -- 2010-11-09
plugin/html2pdf.1261898571.txt.gz · Last modified: 2009-12-27 08:22 by 125.131.236.242

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki