Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

PmWiki2PDF

Summary: Generate a PDF; back up all wiki pages in PDF format
Version: 2005-10-10
Prerequisites: Requires at least PmWiki version: 2.x; last tested on PmWiki version: 2.0.3
Status:
Maintainer: the_CName, JasonGreen
Categories: Obsolete,
Discussion: PmWiki2PDF-Talk

French Version

Question

  • Can I generate a PDF by one click in my browser?
  • Can I then back up all my wiki pages in PDF format?

Answer

You can generate a single PDF simply with this cookbook!

This is obsolete ! Please, see PmWiki2PDF-v2 !

  1. That's all folks.

Backup all pages

For entire site backups (Windows only), please follow the instructions on this cookbook, then go to PmWiki2PDFBackup.

CHANGELOG

  • 2005-10-10
    • Implement password verification ! (thanks Dfaure)
  • 2005-09-29
    • Implement 3 methods html2fpdf :
      1. setBasePath ( to return a good path to include img)
      2. UsePre
      3. UseCSS
    • Correct the element &`ensp; returned by others Cookbooks (PageTableOfContent, ...)
  • 2005-08-21
    • Redefine a correct $HandleActions ! (thanks Schlaefer)
  • 2005-08-20
    • Implement breakpage feature !
  • 2005-08-19
    • Due a bad comprehensive element span, this is desactivate !
  • 2005-08-16
    • Add two variables to manage server limit (MEMORY_LIMIT, MAX_EXECUTION_TIME)
    • modify the FOOTER
  • 2005-08-12
    • First version !

Notes and Comments

  1. The name of the file pdf created consists of the name of the site and the read page, so facilitating its saving on your hard disk!
  2. This cookbook use a FPDF Class ( Freeware ) and this derivated class to function, by ?action=pdf
    This derivated class is HTML2FPDF.

all, but please see this FAQ : http://html2fpdf.sourceforge.net/
if you want to known more on HTML2FPDF.

Used by :

Bugs

It works for IE, but nothing happens when I'm using firefox. Any ideas on what I did wrong? Fran├žois Elie> with Konqueror ? and with firefox without then pdf plugin ? test it

(2007-08-08) For me it wouldn't display the PDF in Acrobat but just display binary stuff in the browser window, probably because the content type was not properly set in the HTTP headers. Adding header("Content-type: application/pdf;charset=ISO-8859-1;"); in function HandlePDF($pagename) of pmwiki2pdf.php fixed the problem for me.

(2008-08-25) by far this solution seems the easiest. I have not had any luck in getting it to work, where do I place header("Content-type: application/pdf;charset=ISO-8859-1;"); in @@ exactly? After the { or in a particular section? Thanks, Chris Also, I keep getting this error Fatal error: Call to undefined method HTML2FPDF::DisplayPreferences() in E:\xampp\htdocs\mywiki\cookbook\pmwiki2pdf\html2fpdf-3.0.2b\html2fpdf4pmwiki.php on line 155

  • 26-Oct-2007 DaveG: For people concerned that this cookbook has not been updated for a while don't be. It works with the latest beta (2.2beta63). As mentioned above you'll need to add the header line in the comment above (I added it just before the read page part of the code). Very easy to install, and very easy to use!
  • 17-Feb-2008 RussFink: I had to apply the Content-type as above, but I also had to chmod 755 everything in the pmwiki2pdf directory and all the subdirectories, else it would not run. Further, I'm using CMSBundle, and had to add "pdf" to the CMSAllowedActions array. I did not add the link to my Template file, but it still worked anyway. One other issue, it does not honor the formatting exactly; e.g., the "+++" fonts appear normal size, >>center<< does not seem to work - but if you use the (:div ...:) markup discussed in WikiStyles, that works for me. Simple tables render wonderfully. Various other minor issues, but yes, it generates PDF files and does not require any other software download. BTW, I'm using 2.2.0-beta65.
  • 17-Feb-2008 RussFink: More tuning hints. By default, this comes up in A4 format. To change to letter, with approximate 1.5" margins left, top, and right, must mod the code. Note, SetMargins does not affect the right margin. Steps to follow:
    • Edit pmwiki2pdf.php, look for "$pdf = new HTML2FPDF();", change to "$pdf = new HTML2FPDF('P', 'mm', 'letter');" Note, using 'in' instead of 'mm' does not work.
    • Edit fpdf.php, look for the line that says "$margin=28.35/$this->k;", change this to "$margin=68.35/$this->k;". I have searched six ways to Sunday to get SetMargin to work, but it doesn't honor the right-side margin - it pushes in the left, but forces text off the right side.
  • just to second what someone else said, but that i missed the first (& second & third) time around: the downloaded folders contain files which have the wrong permission - they're all set to 700, and need to be changed to either 644 or 755 to work...

overtones99 June 24, 2008, at 11:19 AM

  • hrumph... not nearly as easy as it sounds:
    • pages with included content don't print the included sections, so forget pdf-ifying any pages with templates - they're empty...
    • how does one get rid of / modify the footers?
    • there's zero support on the pmwiki list...

beware. overtones99 June 25, 2008, at 04:41 AM

See Also

Contributors

the_CName
JasonGreen

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on September 10, 2011, at 11:42 AM