Content last modified Tuesday 24 August 2021
hop to #bottom
Current version:
About It:
Get it:
Rate it:
  • Helpful?
  • 1 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!


The plugin _(mono)wan_pdf_ generates PDF-versions of your articles. The output is a link to the PDF-file. The PDFs are not generated every time the article is called, but only when the title or the body has changed. For this plugin I used xhtml2pdf and ufpdf which are based on fpdf. All needed files can be found at the end of this article.

Attention: If you update from a version <= 0.2 please download once again and delete all PDFs due to changes in the name scheme.


Original article
PDF version


The installation of this plugin is a little bit more complicated than the installation of other plugins. So here are the instructions:

  1. download the plugin and install and activate in the admin-panel
  2. download the file and unzip it to your local harddrive. After that you copy the folder xhtml2pdf (and not only the content of this folder) into the folder /textpattern/lib/ via ftp.
  3. create a new style with the name _(mono)article_pdf_ and copy & paste the content of the file _(file)article_pdf.css_ into it
  4. create a new file category with the name _(mono)article_pdf_


Just put the tag <txp:wan_pdf /> somewhere in you article form and there will be placed a link to the PDF-version of this article. The following optional arguments are possible:

  • class: CSS-class for the link (default: class=”“)
  • name: Link-text (default: name=“This article as a pdf”)
  • _(mono)show_body:_ show article body in PDF (“y” or “n”, default: show_body=“y”)
  • _(mono)show_excerpt:_ show excerpt in PDF (“y” or“n”, default: show_excerpt=“y”)
  • image: ID of an image that is linked instead of the text (like you can see on this page). If the argument is not set, the default text is used (default: image=”“)
  • _(mono)file_category:_ file categrory the PDF will belong to (default: file_category=“article_pdf”)
  • _(mono)pdf_css_class:_ CSS-class for PDF-creation (default: pdf_css_class=“article_pdf”)
  • debug: only for testing. The XHTML- and CSS-file are not deleted (default: debug=“n”)

The last three arguments are only for advanced users who know what they do.

How it works

With every call of an article the plugin checks, if there exists a PDF with the current version of an article. If this is not the case, first a xhtml-document with this article is created. With the help of xhtml2pdf and the stylesheet article_pdf this xhtml-document is converted into a PDF document. It will be saved in the folder files/ and put into the database at file category “article_pdf”.

If the file is already existing, the only thing the plugin does ist output a link to it.

Customization (for advanced users)

Edit the stylesheet _(mono)article_pdf_ . Also a different stylesheet can be used via the optional argument pdf_css_class.

You can edit the header and the footer of the pdf in the file /textpattern/lib/xhtml2pdf/classes/x2fpdf.php in line 377 (functions header() and footer() ).

At default the PDFs are saved in the category article_pdf. If you want to save in in another category, you have to create it and use it with category=“new_category”.


Version 0.3 (2006-02-22)

  • Feature: Use an image for linking to the PDF instead of text
  • Feature: Debug switch
  • Bugfix: Uses updf instead of fpdf for (hopefully) complete unicode support
  • Bugfix: New name scheme (articleid_urltitle.pdf)
  • Bugfix: Images in the PDF should now work everywhere

Version 0.2 (2006-01-29):

  • Feature: include body and/or excerpt optionally
  • Feature: write PDF metadata (thanks to ChrisJ)
  • Bugfix: new name scheme for PDFs (articleid_title.pdf) to distinguish between two articles with the same title
  • Bugfix: some changen in xhtml2pdf.

Version 0.16 (2006-01-25):

  • Bugfix: Forgot to add the class-argument to the link

Version 0.15 (2006-01-25):

  • Bugfix: replace hardcoded directories with global vars (thanks to chriloi)
  • Bugfix: UTF-8-support for umlauts (thanks to chriloi)

Version 0.1 (2006-01-24):

  • first version
Article Request Count:
Initially released:
24 Jan 06
Posted here:
24 Jan 2006

You know you want to visit the Archives.
Published with Textpattern